forked from bhrugen/Bulky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Section 11 - OrderVM and Retrieve all Orders
- Loading branch information
Showing
4 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BulkyBook.Models.ViewModels | ||
{ | ||
public class OrderVM | ||
{ | ||
public OrderHeader OrderHeader { get; set; } | ||
public IEnumerable<OrderDetail> OrderDetail { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using BulkyBook.DataAccess.Repository.IRepository; | ||
using BulkyBook.Models; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System.Collections.Generic; | ||
|
||
namespace BulkyBookWeb.Areas.Admin.Controllers | ||
{ | ||
public class OrderController : Controller | ||
{ | ||
private readonly IUnitOfWork _unitOfWork; | ||
public OrderController(IUnitOfWork unitOfWork) | ||
{ | ||
_unitOfWork = unitOfWork; | ||
} | ||
|
||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
|
||
#region API CALLS | ||
[HttpGet] | ||
public IActionResult GetAll() | ||
{ | ||
IEnumerable<OrderHeader> orderHeaders; | ||
orderHeaders = _unitOfWork.OrderHeader.GetAll(includeProperties: "ApplicationUser"); | ||
return Json(new { data = orderHeaders }); | ||
} | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@* | ||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 | ||
*@ | ||
@{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters