Loading PresentationLayer.Mvc/Areas/Admin/Controllers/OrderController.cs +3 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ using BusinessLayer.Services.Interfaces; using Infrastructure.QueryObjects; using Microsoft.AspNetCore.Mvc; using PresentationLayer.Mvc.ActionFilters; using PresentationLayer.Mvc.Areas.Customer.Models; using PresentationLayer.Mvc.Models; namespace PresentationLayer.Mvc.Areas.Admin.Controllers; Loading @@ -16,13 +17,13 @@ public class OrderController(IOrderService orderService, IMapper mapper) : Contr public async Task<IActionResult> Index([FromQuery] PaginationViewModel pagination) { var orders = await orderService.GetOrdersAsync(mapper.Map<PaginationDto>(pagination)); return View(mapper.Map<FilteredResult<OrderDetailViewModel>>(orders)); return View(mapper.Map<FilteredResult<OrderViewModel>>(orders)); } [HttpGet] public async Task<IActionResult> Edit(int id) { var order = mapper.Map<OrderDetailViewModel>(await orderService.GetOrderByIdAsync(id)); var order = mapper.Map<OrderDetailViewModel>(await orderService.GetOrderDetailByIdAsync(id)); if (order == null) { ModelState.AddModelError("Id", "Order not found."); Loading PresentationLayer.Mvc/Areas/Admin/Controllers/TagController.cs +4 −4 Original line number Diff line number Diff line Loading @@ -50,18 +50,18 @@ public class TagController(ITagService tagService, IMapper mapper) : Controller if (tag == null) { ModelState.AddModelError("Id", "Tag not found."); return View(tag); return View(mapper.Map<TagViewModel>(tag)); } return View(tag); return View(mapper.Map<TagViewModel>(tag)); } [HttpPost] public async Task<IActionResult> Edit(TagDto viewModel) public async Task<IActionResult> Edit(TagViewModel viewModel) { if (!ModelState.IsValid) return View(viewModel); var updatedTag = await tagService.UpdateTagAsync(viewModel); var updatedTag = await tagService.UpdateTagAsync(mapper.Map<TagDto>(viewModel)); if (updatedTag == null) { ModelState.AddModelError("Id", "Failed to update tag."); Loading PresentationLayer.Mvc/Areas/Admin/Views/Order/Index.cshtml +1 −1 Original line number Diff line number Diff line @using BusinessLayer.DTOs @using PresentationLayer.Mvc @model Infrastructure.QueryObjects.FilteredResult<PresentationLayer.Mvc.Models.OrderDetailViewModel> @model Infrastructure.QueryObjects.FilteredResult<PresentationLayer.Mvc.Areas.Customer.Models.OrderViewModel> @{ ViewData[Constants.Keys.Title] = "Orders"; Loading PresentationLayer.Mvc/Installers/MvcMapperInstaller.cs +3 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ public class MvcMapperInstaller : Profile CreateMap<UserSimpleViewModel, UserDto>().ReverseMap(); CreateMap<UserUpdateRestrictedViewModel, UserDto>().ReverseMap(); CreateMap<UserUpdateRestrictedViewModel, UserUpdateDto>().ReverseMap(); CreateMap<UserUpdateViewModel, UserDto>().ReverseMap(); CreateMap<UserUpdateViewModel, UserUpdateDto>().ReverseMap(); CreateMap<AddToCartViewModel, AddToCartDto>().ReverseMap(); CreateMap<BaseEntityViewModel, BaseEntityDto>().ReverseMap(); CreateMap<CartItemDetailViewModel, CartItemDetailDto>().ReverseMap(); Loading Loading
PresentationLayer.Mvc/Areas/Admin/Controllers/OrderController.cs +3 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ using BusinessLayer.Services.Interfaces; using Infrastructure.QueryObjects; using Microsoft.AspNetCore.Mvc; using PresentationLayer.Mvc.ActionFilters; using PresentationLayer.Mvc.Areas.Customer.Models; using PresentationLayer.Mvc.Models; namespace PresentationLayer.Mvc.Areas.Admin.Controllers; Loading @@ -16,13 +17,13 @@ public class OrderController(IOrderService orderService, IMapper mapper) : Contr public async Task<IActionResult> Index([FromQuery] PaginationViewModel pagination) { var orders = await orderService.GetOrdersAsync(mapper.Map<PaginationDto>(pagination)); return View(mapper.Map<FilteredResult<OrderDetailViewModel>>(orders)); return View(mapper.Map<FilteredResult<OrderViewModel>>(orders)); } [HttpGet] public async Task<IActionResult> Edit(int id) { var order = mapper.Map<OrderDetailViewModel>(await orderService.GetOrderByIdAsync(id)); var order = mapper.Map<OrderDetailViewModel>(await orderService.GetOrderDetailByIdAsync(id)); if (order == null) { ModelState.AddModelError("Id", "Order not found."); Loading
PresentationLayer.Mvc/Areas/Admin/Controllers/TagController.cs +4 −4 Original line number Diff line number Diff line Loading @@ -50,18 +50,18 @@ public class TagController(ITagService tagService, IMapper mapper) : Controller if (tag == null) { ModelState.AddModelError("Id", "Tag not found."); return View(tag); return View(mapper.Map<TagViewModel>(tag)); } return View(tag); return View(mapper.Map<TagViewModel>(tag)); } [HttpPost] public async Task<IActionResult> Edit(TagDto viewModel) public async Task<IActionResult> Edit(TagViewModel viewModel) { if (!ModelState.IsValid) return View(viewModel); var updatedTag = await tagService.UpdateTagAsync(viewModel); var updatedTag = await tagService.UpdateTagAsync(mapper.Map<TagDto>(viewModel)); if (updatedTag == null) { ModelState.AddModelError("Id", "Failed to update tag."); Loading
PresentationLayer.Mvc/Areas/Admin/Views/Order/Index.cshtml +1 −1 Original line number Diff line number Diff line @using BusinessLayer.DTOs @using PresentationLayer.Mvc @model Infrastructure.QueryObjects.FilteredResult<PresentationLayer.Mvc.Models.OrderDetailViewModel> @model Infrastructure.QueryObjects.FilteredResult<PresentationLayer.Mvc.Areas.Customer.Models.OrderViewModel> @{ ViewData[Constants.Keys.Title] = "Orders"; Loading
PresentationLayer.Mvc/Installers/MvcMapperInstaller.cs +3 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ public class MvcMapperInstaller : Profile CreateMap<UserSimpleViewModel, UserDto>().ReverseMap(); CreateMap<UserUpdateRestrictedViewModel, UserDto>().ReverseMap(); CreateMap<UserUpdateRestrictedViewModel, UserUpdateDto>().ReverseMap(); CreateMap<UserUpdateViewModel, UserDto>().ReverseMap(); CreateMap<UserUpdateViewModel, UserUpdateDto>().ReverseMap(); CreateMap<AddToCartViewModel, AddToCartDto>().ReverseMap(); CreateMap<BaseEntityViewModel, BaseEntityDto>().ReverseMap(); CreateMap<CartItemDetailViewModel, CartItemDetailDto>().ReverseMap(); Loading