Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
feat(arch001): cut Admin/Store/Vendor OrderController over to thin subclasses
KrzysztofPajak809385a30b1a
diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/OrderControllerRoutingTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/OrderControllerRoutingTests.csnew file mode 100644index 000000000..3da4aebf3--- /dev/null+++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/OrderControllerRoutingTests.cs@@ -0,0 +1,30 @@+using Grand.Web.Admin.Controllers;+using Grand.Web.AdminShared.Controllers;+using Microsoft.VisualStudio.TestTools.UnitTesting;++namespace Grand.Web.Admin.Tests.Controllers;++[TestClass]+public class OrderControllerRoutingTests+{+ [TestMethod]+ public void AdminOrderController_InheritsBaseOrderManagementController() =>+ Assert.IsTrue(typeof(BaseOrderManagementController).IsAssignableFrom(typeof(OrderController)));++ [TestMethod]+ public void AdminOrderController_HasAutoValidateAntiforgeryToken() =>+ Assert.IsTrue(typeof(OrderController)+ .GetCustomAttributes(typeof(Microsoft.AspNetCore.Mvc.AutoValidateAntiforgeryTokenAttribute), false)+ .Length > 0);++ [TestMethod]+ public void AdminOrderController_DeclaresExportAndDeleteSelectedItself()+ {+ var declared = typeof(OrderController)+ .GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly)+ .Select(m => m.Name).ToHashSet();+ Assert.IsTrue(declared.Contains("ExportExcelAll"));+ Assert.IsTrue(declared.Contains("ExportExcelSelected"));+ Assert.IsTrue(declared.Contains("DeleteSelected"));+ }+}diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/OrderControllerRoutingTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/OrderControllerRoutingTests.csnew file mode 100644index 000000000..6b87e4533--- /dev/null+++ b/src/Tests/Grand.Web.Store.Tests/Controllers/OrderControllerRoutingTests.cs@@ -0,0 +1,30 @@+using Grand.Web.AdminShared.Controllers;+using Grand.Web.Store.Controllers;+using Microsoft.VisualStudio.TestTools.UnitTesting;++namespace Grand.Web.Store.Tests.Controllers;++[TestClass]+public class StoreControllerRoutingTests+{+ [TestMethod]+ public void StoreOrderController_InheritsBaseOrderManagementController() =>+ Assert.IsTrue(typeof(BaseOrderManagementController).IsAssignableFrom(typeof(OrderController)));++ [TestMethod]+ public void StoreOrderController_HasAutoValidateAntiforgeryToken() =>+ Assert.IsTrue(typeof(OrderController)+ .GetCustomAttributes(typeof(Microsoft.AspNetCore.Mvc.AutoValidateAntiforgeryTokenAttribute), false)+ .Length > 0);++ [TestMethod]+ public void StoreOrderController_DoesNotDeclareAdminOnlyExportOrDeleteSelected()+ {+ var declared = typeof(OrderController)+ .GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly)+ .Select(m => m.Name).ToHashSet();+ Assert.IsFalse(declared.Contains("ExportExcelAll"));+ Assert.IsFalse(declared.Contains("ExportExcelSelected"));+ Assert.IsFalse(declared.Contains("DeleteSelected"));+ }+}diff --git a/src/Tests/Grand.Web.Vendor.Tests/Controllers/OrderControllerSurfaceTests.cs b/src/Tests/Grand.Web.Vendor.Tests/Controllers/OrderControllerSurfaceTests.csnew file mode 100644index 000000000..4cc64ccb9--- /dev/null+++ b/src/Tests/Grand.Web.Vendor.Tests/Controllers/OrderControllerSurfaceTests.cs@@ -0,0 +1,39 @@+using Grand.Web.Vendor.Controllers;+using Microsoft.VisualStudio.TestTools.UnitTesting;++namespace Grand.Web.Vendor.Tests.Controllers;++[TestClass]+public class OrderControllerSurfaceTests+{+ // Regression guard for ARCH-001 Order consolidation spec §3.5: Vendor's OrderController must+ // inherit BaseOrderController directly, never BaseOrderManagementController, so no mutating+ // action method exists on its type at all - not permission-gated, genuinely absent.+ private static readonly string[] ManagementOnlyActionNames = [+ "CancelOrder", "SaveOrderTags", "ChangeOrderStatus", "Delete", "EditOrderTotals",+ "EditShippingMethod", "EditUserFields", "SaveOrderItem", "DeleteOrderItem",+ "CancelOrderItem", "ResetDownloadCount", "ActivateDownloadItem", "UploadLicenseFilePopup",+ "DeleteLicenseFilePopup", "AddProductToOrder", "AddProductToOrderDetails", "AddressEdit",+ "OrderNotesSelect", "OrderNoteAdd", "OrderNoteDelete", "ExportExcelAll",+ "ExportExcelSelected", "DeleteSelected"+ ];++ [TestMethod]+ public void VendorOrderController_DoesNotInheritBaseOrderManagementController()+ {+ Assert.IsFalse(typeof(Grand.Web.AdminShared.Controllers.BaseOrderManagementController)+ .IsAssignableFrom(typeof(OrderController)));+ }++ [TestMethod]+ public void VendorOrderController_HasNoManagementOnlyActionMethods()+ {+ var declaredMethodNames = typeof(OrderController)+ .GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)+ .Select(m => m.Name)+ .ToHashSet();++ var leaked = ManagementOnlyActionNames.Where(declaredMethodNames.Contains).ToList();+ Assert.AreEqual(0, leaked.Count, $"Vendor's OrderController exposes management-only action(s): {string.Join(", ", leaked)}");+ }+}diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderController.csindex bf23eb73c..10114abec 100644--- a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs@@ -1,28 +1,33 @@-using Grand.Business.Core.Commands.Checkout.Orders;+using Grand.Business.Core.Commands.Checkout.Orders;using Grand.Business.Core.Interfaces.Catalog.Products;using Grand.Business.Core.Interfaces.Checkout.Orders;using Grand.Business.Core.Interfaces.Checkout.Shipping;-using Grand.Business.Core.Interfaces.Common.Addresses;-using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Common.Pdf;using Grand.Business.Core.Interfaces.ExportImport;-using Grand.Domain.Catalog;-using Grand.Domain.Common;using Grand.Domain.Orders;using Grand.Domain.Permissions;using Grand.Infrastructure;-using Grand.Web.AdminShared.Extensions;+using Grand.Mediator;+using Grand.Web.Admin.Extensions;+using Grand.Web.AdminShared.Controllers;using Grand.Web.AdminShared.Interfaces;using Grand.Web.AdminShared.Models.Orders;-using Grand.Web.Common.DataSource;+using Grand.Web.Common.Filters;using Grand.Web.Common.Security.Authorization;-using Grand.Mediator;using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Admin.Controllers;-[PermissionAuthorize(PermissionSystemName.Orders)]+// Concrete host subclass of BaseOrderManagementController (ARCH-001 Order consolidation). This class+// supplies Admin's DI wiring plus the attributes that used to arrive transitively via+// BaseAdminController - BaseOrderManagementController can't inherit any single host's base controller+// (it's shared across Admin/Store, each with a different [Area]/[Authorize*] pair), so each subclass+// restates its own host's attribute set explicitly, same pattern as CategoryController/ProductController.+[AuthorizeAdmin]+[AutoValidateAntiforgeryToken]+[Area(Constants.AreaAdmin)]+[AuthorizeMenu]public class OrderController(IOrderViewModelService orderViewModelService,IOrderService orderService,@@ -30,106 +35,21 @@ public class OrderController(ITranslationService translationService,IContextAccessor contextAccessor,IPdfService pdfService,- IGroupService groupService,- IExportManager<Order> exportManager,- IMediator mediator)- : BaseAdminController+ IMediator mediator,+ IAdminDataScope<Order> scope,+ IExportManager<Order> exportManager)+ : BaseOrderManagementController(orderViewModelService, orderService, orderStatusService,+ translationService, contextAccessor, pdfService, mediator, scope){- #region Utilities-- protected virtual async Task<bool> CheckSalesManager(Order order)- {- return await groupService.IsSalesManager(contextAccessor.WorkContext.CurrentCustomer)- && contextAccessor.WorkContext.CurrentCustomer.SeId != order.SeId;- }-- #endregion-- #region Order list-- public IActionResult Index()- {- return RedirectToAction("List");- }-- public async Task<IActionResult> List(int? orderStatusId = null,- int? paymentStatusId = null, int? shippingStatusId = null, DateTime? startDate = null, string code = null)- {- var model = await orderViewModelService.PrepareOrderListModel(orderStatusId, paymentStatusId, shippingStatusId, startDate, "", code);- return View(model);- }-- public async Task<IActionResult> ProductSearchAutoComplete(string term,- [FromServices] IProductService productService)- {- const int searchTermMinimumLength = 3;- if (string.IsNullOrWhiteSpace(term) || term.Length < searchTermMinimumLength)- return Content("");-- //products- const int productNumber = 15;- var products = (await productService.SearchProducts(- keywords: term,- pageSize: productNumber,- showHidden: true)).products;-- var result = (from p in products- select new- {- label = p.Name,- productid = p.Id- })- .ToList();- return Json(result);- }-- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> OrderList(DataSourceRequest command, OrderListModel model)- {- var (orderModels, totalCount) =- await orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);-- var gridModel = new DataSourceResult {- Data = orderModels.ToList(),- Total = totalCount- };- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> GoToOrderId(OrderListModel model)- {- Order order = null;- int.TryParse(model.GoDirectlyToNumber, out var orderNumber);- if (orderNumber > 0) order = await orderService.GetOrderByNumber(orderNumber);- var orders = await orderService.GetOrdersByCode(model.GoDirectlyToNumber);- switch (orders.Count)- {- case > 1:- return RedirectToAction("List", new { Code = model.GoDirectlyToNumber });- case 1:- order = orders.FirstOrDefault();- break;- }-- if (order == null || await CheckSalesManager(order))- return RedirectToAction("List");-- return RedirectToAction("Edit", "Order", new { id = order.Id });- }-- #endregion-- #region Export+ // Admin-exclusive: Store already holds the Export/Delete PermissionActionName grants (used by+ // PdfInvoiceAll/PdfInvoiceSelected/Delete today), so these three stay off both base classes -+ // see plan's Global Constraints and spec §3.6.[PermissionAuthorizeAction(PermissionActionName.Export)][HttpPost]public async Task<IActionResult> ExportExcelAll(OrderListModel model){- //load orders- var orders = await orderViewModelService.PrepareOrders(model);+ var orders = await OrderViewModelService.PrepareOrders(model);try{var bytes = await exportManager.Export(orders);@@ -149,145 +69,14 @@ public class OrderController(var orders = new List<Order>();if (selectedIds != null){- var ids = selectedIds- .Split([','], StringSplitOptions.RemoveEmptyEntries)- .Select(x => x)- .ToArray();- orders.AddRange(await orderService.GetOrdersByIds(ids));+ var ids = selectedIds.Split([','], StringSplitOptions.RemoveEmptyEntries).ToArray();+ orders.AddRange(await OrderService.GetOrdersByIds(ids));}var bytes = await exportManager.Export(orders);return File(bytes, "text/xls", "orders.xlsx");}- #endregion-- #region Order details-- #region Payments and other order workflow-- [PermissionAuthorizeAction(PermissionActionName.Cancel)]- [HttpGet]- public async Task<IActionResult> CancelOrder(string id)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- try- {- await mediator.Send(new CancelOrderCommand { Order = order, NotifyCustomer = true });-- Success("Successfully canceled order");- return RedirectToAction("Edit", "Order", new { id });- }- catch (Exception exc)- {- //error- Error(exc);- return RedirectToAction("Edit", "Order", new { id });- }- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SaveOrderTags(OrderModel orderModel)- {- var order = await orderService.GetOrderById(orderModel.Id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- try- {- await orderViewModelService.SaveOrderTags(order, orderModel.OrderTags);-- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);- return RedirectToAction("Edit", "Order", new { id = order.Id });- }- catch (Exception exception)- {- //error- Error(exception, false);- return RedirectToAction("Edit", "Order", new { id = order.Id });- }- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ChangeOrderStatus(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- try- {- var status = await orderStatusService.GetByStatusId(model.OrderStatusId);- ArgumentNullException.ThrowIfNull(status);-- order.OrderStatusId = model.OrderStatusId;- await orderService.UpdateOrder(order);-- //add a note- await orderService.InsertOrderNote(new OrderNote {- Note = $"Order status has been edited. New status: {status.Name}",- DisplayToCustomer = false,- OrderId = order.Id- });- model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);- return RedirectToAction("Edit", "Order", new { id });- }- catch (Exception exc)- {- //error- Error(exc, false);- return RedirectToAction("Edit", "Order", new { id });- }- }-- #endregion-- #region Edit, delete-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> Edit(string id)- {- var order = await orderService.GetOrderById(id);- if (order == null || order.Deleted || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> Delete(OrderDeleteModel model)- {- var order = await orderService.GetOrderById(model.Id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- if (ModelState.IsValid)- {- await mediator.Send(new DeleteOrderCommand { Order = order });-- return RedirectToAction("List");- }-- Error(ModelState);- return RedirectToAction("Edit", "Order", new { model.Id });- }-[PermissionAuthorizeAction(PermissionActionName.Delete)][HttpPost]public async Task<IActionResult> DeleteSelected(@@ -297,579 +86,17 @@ public class OrderController(if (selectedIds != null){var orders = new List<Order>();- orders.AddRange(await orderService.GetOrdersByIds(selectedIds.ToArray()));- for (var i = 0; i < orders.Count; i++)+ orders.AddRange(await OrderService.GetOrdersByIds(selectedIds.ToArray()));+ foreach (var order in orders){- var order = orders[i];var shipments = await shipmentService.GetShipmentsByOrder(order.Id);if (shipments.Any())Error("Some orders is in associated with shipments. Please delete it first.");-- if (!shipments.Any()) await mediator.Send(new DeleteOrderCommand { Order = order });+ else+ await Mediator.Send(new DeleteOrderCommand { Order = order });}}return Json(new { Result = true });}-- public async Task<IActionResult> PdfInvoice(string orderId)- {- var order = await orderService.GetOrderById(orderId);- if (await CheckSalesManager(order)) return RedirectToAction("List");-- var orders = new List<Order> {- order- };- byte[] bytes;- using (var stream = new MemoryStream())- {- await pdfService.PrintOrdersToPdf(stream, orders, contextAccessor.WorkContext.WorkingLanguage.Id);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", $"order_{order.Id}.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceAll(OrderListModel model)- {- //load orders- var orders = await orderViewModelService.PrepareOrders(model);-- byte[] bytes;- using (var stream = new MemoryStream())- {- await pdfService.PrintOrdersToPdf(stream, orders, contextAccessor.WorkContext.WorkingLanguage.Id, model.VendorId);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", "orders.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceSelected(string selectedIds)- {- var orders = new List<Order>();- if (selectedIds != null)- {- var ids = selectedIds- .Split([','], StringSplitOptions.RemoveEmptyEntries)- .Select(x => x)- .ToArray();- orders.AddRange(await orderService.GetOrdersByIds(ids));- }-- //ensure that we at least one order selected- if (orders.Count == 0)- {- Error(translationService.GetResource("Admin.Orders.PdfInvoice.NoOrders"));- return RedirectToAction("List");- }-- byte[] bytes;- using (var stream = new MemoryStream())- {- await pdfService.PrintOrdersToPdf(stream, orders, contextAccessor.WorkContext.WorkingLanguage.Id);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", "orders.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> EditOrderTotals(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- order.OrderSubtotalInclTax = model.OrderSubtotalInclTaxValue;- order.OrderSubtotalExclTax = model.OrderSubtotalExclTaxValue;- order.OrderSubTotalDiscountInclTax = model.OrderSubTotalDiscountInclTaxValue;- order.OrderSubTotalDiscountExclTax = model.OrderSubTotalDiscountExclTaxValue;- order.OrderShippingInclTax = model.OrderShippingInclTaxValue;- order.OrderShippingExclTax = model.OrderShippingExclTaxValue;- order.PaymentMethodAdditionalFeeInclTax = model.PaymentMethodAdditionalFeeInclTaxValue;- order.PaymentMethodAdditionalFeeExclTax = model.PaymentMethodAdditionalFeeExclTaxValue;- order.OrderTax = model.TaxValue;- order.OrderDiscount = model.OrderTotalDiscountValue;- order.OrderTotal = model.OrderTotalValue;- order.CurrencyRate = model.CurrencyRate;- await orderService.UpdateOrder(order);-- //add a note- await orderService.InsertOrderNote(new OrderNote {- Note = "Order totals have been edited",- DisplayToCustomer = false,- OrderId = order.Id- });-- await orderViewModelService.PrepareOrderDetailsModel(model, order);- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> EditShippingMethod(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- order.ShippingMethod = model.ShippingMethod;- await orderService.UpdateOrder(order);-- //add a note- await orderService.InsertOrderNote(new OrderNote {- Note = "Shipping method has been edited",- DisplayToCustomer = false,- OrderId = order.Id- });- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [HttpPost]- public async Task<IActionResult> EditUserFields(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- order.UserFields = model.UserFields;-- await orderService.UpdateOrder(order);-- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SaveOrderItem(string id, OrderItemsModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- if (order.OrderStatusId == (int)OrderStatusSystem.Cancelled)- {- Error("You can't edit position when order is canceled");- return RedirectToAction("Edit", "Order", new { id });- }-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == model.OrderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var itemModel = model.Items.FirstOrDefault(x => x.Id == model.OrderItemId) ?? throw new ArgumentException("No order item model found with the specified id");-- if (itemModel.Quantity == 0 || (orderItem.OpenQty != orderItem.Quantity && orderItem.IsShipEnabled))- {- Error("You can't change quantity");- return RedirectToAction("Edit", "Order", new { id });- }-- if (orderItem.Quantity == itemModel.Quantity && orderItem.UnitPriceExclTax == itemModel.UnitPriceExclTaxValue)- {- Error("Nothing has been changed");- return RedirectToAction("Edit", "Order", new { id });- }-- orderItem.Quantity = itemModel.Quantity;- orderItem.OpenQty = itemModel.Quantity;-- if (orderItem.UnitPriceExclTax != itemModel.UnitPriceExclTaxValue)- {- orderItem.UnitPriceExclTax = itemModel.UnitPriceExclTaxValue;- orderItem.UnitPriceInclTax =- Math.Round(orderItem.UnitPriceExclTax * orderItem.TaxRate / 100 + orderItem.UnitPriceExclTax, 2);- orderItem.PriceInclTax = Math.Round(orderItem.UnitPriceInclTax * orderItem.Quantity, 2);- orderItem.PriceExclTax = Math.Round(orderItem.UnitPriceExclTax * orderItem.Quantity, 2);-- orderItem.DiscountAmountInclTax = 0;- orderItem.DiscountAmountExclTax = 0;- }- else- {- orderItem.PriceInclTax = Math.Round(orderItem.UnitPriceInclTax * orderItem.Quantity, 2);- orderItem.PriceExclTax = Math.Round(orderItem.UnitPriceExclTax * orderItem.Quantity, 2);-- orderItem.DiscountAmountInclTax = 0;- orderItem.DiscountAmountExclTax = 0;- }-- await mediator.Send(new UpdateOrderItemCommand { Order = order, OrderItem = orderItem });-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> DeleteOrderItem(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var result = await mediator.Send(new DeleteOrderItemCommand { Order = order, OrderItem = orderItem });- if (result.error)- Error(result.message);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> CancelOrderItem(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var result = await mediator.Send(new CancelOrderItemCommand { Order = order, OrderItem = orderItem });- if (result.error)- Error(result.message);- else- Success("The order item was successfully canceled");-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ResetDownloadCount(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- orderItem.DownloadCount = 0;- await orderService.UpdateOrder(order);- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ActivateDownloadItem(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- orderItem.IsDownloadActivated = !orderItem.IsDownloadActivated;- await orderService.UpdateOrder(order);- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> UploadLicenseFilePopup(string id, string orderItemId,- [FromServices] IProductService productService)- {- var order = await orderService.GetOrderById(id);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var product = await productService.GetProductByIdIncludeArch(orderItem.ProductId);-- if (!product.IsDownload)- throw new ArgumentException("Product is not downloadable");- var model = new OrderModel.UploadLicenseModel {- LicenseDownloadId = !string.IsNullOrEmpty(orderItem.LicenseDownloadId) ? orderItem.LicenseDownloadId : "",- OrderId = order.Id,- OrderItemId = orderItem.Id- };-- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> UploadLicenseFilePopup(OrderModel.UploadLicenseModel model)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == model.OrderItemId) ?? throw new ArgumentException("No order item found with the specified id");-- //attach license- orderItem.LicenseDownloadId = !string.IsNullOrEmpty(model.LicenseDownloadId) ? model.LicenseDownloadId : null;- await orderService.UpdateOrder(order);-- //success- ViewBag.RefreshPage = true;-- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> DeleteLicenseFilePopup(OrderModel.UploadLicenseModel model)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == model.OrderItemId) ?? throw new ArgumentException("No order item found with the specified id");-- //attach license- orderItem.LicenseDownloadId = null;- await orderService.UpdateOrder(order);-- //success- ViewBag.RefreshPage = true;-- return RedirectToAction("Edit", "Order", new { id = model.OrderId });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> AddProductToOrder(string orderId)- {- var order = await orderService.GetOrderById(orderId);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var model = await orderViewModelService.PrepareAddOrderProductModel(order);- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AddProductToOrder(DataSourceRequest command, OrderModel.AddOrderProductModel model,- [FromServices] IProductService productService)- {- var categoryIds = new List<string>();- if (!string.IsNullOrEmpty(model.SearchCategoryId))- categoryIds.Add(model.SearchCategoryId);-- var gridModel = new DataSourceResult();- var products = (await productService.SearchProducts(categoryIds: categoryIds,- brandId: model.SearchBrandId,- collectionId: model.SearchCollectionId,- productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,- keywords: model.SearchProductName,- pageIndex: command.Page - 1,- pageSize: command.PageSize,- showHidden: true)).products;- gridModel.Data = products.Select(x =>- {- var productModel = new OrderModel.AddOrderProductModel.ProductModel {- Id = x.Id,- Name = x.Name,- Sku = x.Sku- };-- return productModel;- });- gridModel.Total = products.TotalCount;-- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> AddProductToOrderDetails(string orderId, string productId)- {- var order = await orderService.GetOrderById(orderId);- if (order == null || await CheckSalesManager(order))- return RedirectToAction("List");-- var model = await orderViewModelService.PrepareAddProductToOrderModel(order, productId);- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AddProductToOrderDetails(AddProductToOrderModel model)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null || await CheckSalesManager(order))- return RedirectToAction("List");-- var warnings = await orderViewModelService.AddProductToOrderDetails(model);- if (!warnings.Any())- //redirect to order details page- return RedirectToAction("Edit", "Order", new { id = model.OrderId });-- //errors- var result = await orderViewModelService.PrepareAddProductToOrderModel(order, model.ProductId);- result.Warnings.AddRange(warnings);- return View(result);- }-- #endregion-- #endregion-- #region Addresses-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> AddressEdit(string addressId, string orderId, bool billingAddress)- {- var order = await orderService.GetOrderById(orderId);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var address = new Address();- switch (billingAddress)- {- case true when order.BillingAddress != null:- {- if (order.BillingAddress.Id == addressId)- address = order.BillingAddress;- break;- }- case false when order.ShippingAddress != null:- {- if (order.ShippingAddress.Id == addressId)- address = order.ShippingAddress;- break;- }- }-- if (address == null)- throw new ArgumentException("No address found with the specified id", nameof(addressId));-- var model = await orderViewModelService.PrepareOrderAddressModel(order, address);- model.BillingAddress = billingAddress;- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AddressEdit(OrderAddressModel model,- [FromServices] IAddressAttributeService addressAttributeService,- [FromServices] IAddressAttributeParser addressAttributeParser)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null || await CheckSalesManager(order))- //No order found with the specified id- return RedirectToAction("List");-- var address = new Address();- switch (model.BillingAddress)- {- case true when order.BillingAddress != null:- {- if (order.BillingAddress.Id == model.Address.Id)- address = order.BillingAddress;- break;- }- case false when order.ShippingAddress != null:- {- if (order.ShippingAddress.Id == model.Address.Id)- address = order.ShippingAddress;- break;- }- }-- if (ModelState.IsValid)- {- var customAttributes =- await model.Address.ParseCustomAddressAttributes(addressAttributeParser, addressAttributeService);- await orderViewModelService.UpdateOrderAddress(order, address, model, customAttributes);- return RedirectToAction("AddressEdit",- new { addressId = model.Address.Id, orderId = model.OrderId, model.BillingAddress });- }-- //If we got this far, something failed, redisplay form- model = await orderViewModelService.PrepareOrderAddressModel(order, address);- return View(model);- }-- #endregion-- #region Order notes-- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> OrderNotesSelect(string orderId, DataSourceRequest command)- {- var order = await orderService.GetOrderById(orderId);- if (order == null || await CheckSalesManager(order))- throw new ArgumentException("No order found with the specified id");-- //order notes- var orderNoteModels = await orderViewModelService.PrepareOrderNotes(order);- var gridModel = new DataSourceResult {- Data = orderNoteModels,- Total = orderNoteModels.Count- };- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> OrderNoteAdd(string orderId, string downloadId, bool displayToCustomer,- string message)- {- var order = await orderService.GetOrderById(orderId);- if (order == null || await CheckSalesManager(order))- return Json(new { Result = false });-- await orderViewModelService.InsertOrderNote(order, downloadId, displayToCustomer, message);-- return Json(new { Result = true });- }-- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> OrderNoteDelete(string id, string orderId)- {- var order = await orderService.GetOrderById(orderId);- if (order == null || await CheckSalesManager(order))- throw new ArgumentException("No order found with the specified id");-- await orderViewModelService.DeleteOrderNote(order, id);-- return new JsonResult("");- }-- #endregion-}\ No newline at end of file+}diff --git a/src/Web/Grand.Web.Store/Controllers/OrderController.cs b/src/Web/Grand.Web.Store/Controllers/OrderController.csindex fe9ac87d6..cfaf40088 100644--- a/src/Web/Grand.Web.Store/Controllers/OrderController.cs+++ b/src/Web/Grand.Web.Store/Controllers/OrderController.cs@@ -1,25 +1,26 @@-using Grand.Business.Core.Commands.Checkout.Orders;-using Grand.Business.Core.Interfaces.Catalog.Products;using Grand.Business.Core.Interfaces.Checkout.Orders;-using Grand.Business.Core.Interfaces.Common.Addresses;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Common.Pdf;-using Grand.Domain.Catalog;-using Grand.Domain.Common;using Grand.Domain.Orders;-using Grand.Domain.Permissions;using Grand.Infrastructure;-using Grand.Web.AdminShared.Extensions;-using Grand.Web.AdminShared.Interfaces;-using Grand.Web.AdminShared.Models.Orders;-using Grand.Web.Common.DataSource;-using Grand.Web.Common.Security.Authorization;using Grand.Mediator;+using Grand.Web.AdminShared.Controllers;+using Grand.Web.AdminShared.Interfaces;+using Grand.Web.Common.Filters;+using Grand.Web.Store.Extensions;using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Store.Controllers;-[PermissionAuthorize(PermissionSystemName.Orders)]+// Concrete host subclass of BaseOrderManagementController (ARCH-001 Order consolidation). This class+// supplies Store's DI wiring plus the attributes that used to arrive transitively via+// BaseStoreController - BaseOrderManagementController can't inherit any single host's base controller+// (it's shared across Admin/Store, each with a different [Area]/[Authorize*] pair), so each subclass+// restates its own host's attribute set explicitly, same pattern as CategoryController/ProductController.+[AutoValidateAntiforgeryToken]+[Area(Constants.AreaStore)]+[AuthorizeStore]+[AuthorizeMenu]public class OrderController(IOrderViewModelService orderViewModelService,IOrderService orderService,@@ -27,832 +28,7 @@ public class OrderController(ITranslationService translationService,IContextAccessor contextAccessor,IPdfService pdfService,- IMediator mediator) : BaseStoreController-{-- #region Order list-- public IActionResult Index()- {- return RedirectToAction("List");- }-- public async Task<IActionResult> List(int? orderStatusId = null,- int? paymentStatusId = null, int? shippingStatusId = null, DateTime? startDate = null, string code = null)- {- var model = await orderViewModelService.PrepareOrderListModel(orderStatusId, paymentStatusId, shippingStatusId,- startDate, contextAccessor.WorkContext.CurrentCustomer.StaffStoreId, code);- return View(model);- }-- public async Task<IActionResult> ProductSearchAutoComplete(string term,- [FromServices] IProductService productService)- {- const int searchTermMinimumLength = 3;- if (string.IsNullOrWhiteSpace(term) || term.Length < searchTermMinimumLength)- return Content("");-- //products- const int productNumber = 15;- var products = (await productService.SearchProducts(- storeId: contextAccessor.WorkContext.CurrentCustomer.StaffStoreId,- keywords: term,- pageSize: productNumber,- showHidden: true)).products;-- var result = (from p in products- select new- {- label = p.Name,- productid = p.Id- })- .ToList();- return Json(result);- }-- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> OrderList(DataSourceRequest command, OrderListModel model)- {- model.StoreId = contextAccessor.WorkContext.CurrentCustomer.StaffStoreId;-- var (orderModels, totalCount) =- await orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);-- var gridModel = new DataSourceResult {- Data = orderModels.ToList(),- Total = totalCount- };- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> GoToOrderId(OrderListModel model)- {- Order order = null;- int.TryParse(model.GoDirectlyToNumber, out var orderNumber);- if (orderNumber > 0) order = await orderService.GetOrderByNumber(orderNumber);- var orders = await orderService.GetOrdersByCode(model.GoDirectlyToNumber);- switch (orders.Count)- {- case > 1:- return RedirectToAction("List", new { Code = model.GoDirectlyToNumber });- case 1:- order = orders.FirstOrDefault();- break;- case 0:- return RedirectToAction("List", new { Code = model.GoDirectlyToNumber });- }-- if (order!.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- return RedirectToAction("Edit", "Order", new { id = order.Id });- }-- #endregion-- #region Order details-- #region Payments and other order workflow-- [PermissionAuthorizeAction(PermissionActionName.Cancel)]- [HttpGet]- public async Task<IActionResult> CancelOrder(string id)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- try- {- await mediator.Send(new CancelOrderCommand { Order = order, NotifyCustomer = true });-- Success("Successfully canceled order");- return RedirectToAction("Edit", "Order", new { id });- }- catch (Exception exc)- {- //error- Error(exc);- return RedirectToAction("Edit", "Order", new { id });- }- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SaveOrderTags(OrderModel orderModel)- {- var order = await orderService.GetOrderById(orderModel.Id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- try- {- await orderViewModelService.SaveOrderTags(order, orderModel.OrderTags);-- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);- return RedirectToAction("Edit", "Order", new { id = order.Id });- }- catch (Exception exception)- {- //error- Error(exception, false);- return RedirectToAction("Edit", "Order", new { id = order.Id });- }- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ChangeOrderStatus(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- try- {- var status = await orderStatusService.GetByStatusId(model.OrderStatusId);- ArgumentNullException.ThrowIfNull(status);-- order.OrderStatusId = model.OrderStatusId;- await orderService.UpdateOrder(order);-- //add a note- await orderService.InsertOrderNote(new OrderNote {- Note = $"Order status has been edited. New status: {status.Name}",- DisplayToCustomer = false,- OrderId = order.Id- });- model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);- return RedirectToAction("Edit", "Order", new { id });- }- catch (Exception exc)- {- //error- Error(exc, false);- return RedirectToAction("Edit", "Order", new { id });- }- }-- #endregion-- #region Edit, delete-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> Edit(string id)- {- var order = await orderService.GetOrderById(id);- if (order == null || order.Deleted)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> Delete(OrderDeleteModel model)- {- var order = await orderService.GetOrderById(model.Id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- if (ModelState.IsValid)- {- await mediator.Send(new DeleteOrderCommand { Order = order });-- return RedirectToAction("List");- }-- Error(ModelState);- return RedirectToAction("Edit", "Order", new { model.Id });- }-- public async Task<IActionResult> PdfInvoice(string orderId)- {- var order = await orderService.GetOrderById(orderId);- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- var orders = new List<Order> {- order- };- byte[] bytes;- using (var stream = new MemoryStream())- {- await pdfService.PrintOrdersToPdf(stream, orders, contextAccessor.WorkContext.WorkingLanguage.Id);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", $"order_{order.Id}.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceAll(OrderListModel model)- {- //load orders- var orders = await orderViewModelService.PrepareOrders(model);- orders = orders.Where(x => x.StoreId == contextAccessor.WorkContext.CurrentCustomer.StaffStoreId).ToList();-- byte[] bytes;- using (var stream = new MemoryStream())- {- await pdfService.PrintOrdersToPdf(stream, orders, contextAccessor.WorkContext.WorkingLanguage.Id, model.VendorId);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", "orders.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceSelected(string selectedIds)- {- var orders = new List<Order>();- if (selectedIds != null)- {- var ids = selectedIds- .Split([','], StringSplitOptions.RemoveEmptyEntries)- .Select(x => x)- .ToArray();- orders.AddRange(await orderService.GetOrdersByIds(ids));- }-- orders = orders.Where(x => x.StoreId == contextAccessor.WorkContext.CurrentCustomer.StaffStoreId).ToList();-- //ensure that we at least one order selected- if (orders.Count == 0)- {- Error(translationService.GetResource("Admin.Orders.PdfInvoice.NoOrders"));- return RedirectToAction("List");- }-- byte[] bytes;- using (var stream = new MemoryStream())- {- await pdfService.PrintOrdersToPdf(stream, orders, contextAccessor.WorkContext.WorkingLanguage.Id);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", "orders.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> EditOrderTotals(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- order.OrderSubtotalInclTax = model.OrderSubtotalInclTaxValue;- order.OrderSubtotalExclTax = model.OrderSubtotalExclTaxValue;- order.OrderSubTotalDiscountInclTax = model.OrderSubTotalDiscountInclTaxValue;- order.OrderSubTotalDiscountExclTax = model.OrderSubTotalDiscountExclTaxValue;- order.OrderShippingInclTax = model.OrderShippingInclTaxValue;- order.OrderShippingExclTax = model.OrderShippingExclTaxValue;- order.PaymentMethodAdditionalFeeInclTax = model.PaymentMethodAdditionalFeeInclTaxValue;- order.PaymentMethodAdditionalFeeExclTax = model.PaymentMethodAdditionalFeeExclTaxValue;- order.OrderTax = model.TaxValue;- order.OrderDiscount = model.OrderTotalDiscountValue;- order.OrderTotal = model.OrderTotalValue;- order.CurrencyRate = model.CurrencyRate;- await orderService.UpdateOrder(order);-- //add a note- await orderService.InsertOrderNote(new OrderNote {- Note = "Order totals have been edited",- DisplayToCustomer = false,- OrderId = order.Id- });-- await orderViewModelService.PrepareOrderDetailsModel(model, order);- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> EditShippingMethod(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- order.ShippingMethod = model.ShippingMethod;- await orderService.UpdateOrder(order);-- //add a note- await orderService.InsertOrderNote(new OrderNote {- Note = "Shipping method has been edited",- DisplayToCustomer = false,- OrderId = order.Id- });- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [HttpPost]- public async Task<IActionResult> EditUserFields(string id, OrderModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- order.UserFields = model.UserFields;-- await orderService.UpdateOrder(order);-- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SaveOrderItem(string id, OrderItemsModel model)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- if (order.OrderStatusId == (int)OrderStatusSystem.Cancelled)- {- Error("You can't edit position when order is canceled");- return RedirectToAction("Edit", "Order", new { id });- }-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == model.OrderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var itemModel = model.Items.FirstOrDefault(x => x.Id == model.OrderItemId) ?? throw new ArgumentException("No order item model found with the specified id");-- if (itemModel.Quantity == 0 || (orderItem.OpenQty != orderItem.Quantity && orderItem.IsShipEnabled))- {- Error("You can't change quantity");- return RedirectToAction("Edit", "Order", new { id });- }-- if (orderItem.Quantity == itemModel.Quantity && orderItem.UnitPriceExclTax == itemModel.UnitPriceExclTaxValue)- {- Error("Nothing has been changed");- return RedirectToAction("Edit", "Order", new { id });- }-- orderItem.Quantity = itemModel.Quantity;- orderItem.OpenQty = itemModel.Quantity;-- if (orderItem.UnitPriceExclTax != itemModel.UnitPriceExclTaxValue)- {- orderItem.UnitPriceExclTax = itemModel.UnitPriceExclTaxValue;- orderItem.UnitPriceInclTax =- Math.Round(orderItem.UnitPriceExclTax * orderItem.TaxRate / 100 + orderItem.UnitPriceExclTax, 2);- orderItem.PriceInclTax = Math.Round(orderItem.UnitPriceInclTax * orderItem.Quantity, 2);- orderItem.PriceExclTax = Math.Round(orderItem.UnitPriceExclTax * orderItem.Quantity, 2);-- orderItem.DiscountAmountInclTax = 0;- orderItem.DiscountAmountExclTax = 0;- }- else- {- orderItem.PriceInclTax = Math.Round(orderItem.UnitPriceInclTax * orderItem.Quantity, 2);- orderItem.PriceExclTax = Math.Round(orderItem.UnitPriceExclTax * orderItem.Quantity, 2);-- orderItem.DiscountAmountInclTax = 0;- orderItem.DiscountAmountExclTax = 0;- }-- await mediator.Send(new UpdateOrderItemCommand { Order = order, OrderItem = orderItem });-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> DeleteOrderItem(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var result = await mediator.Send(new DeleteOrderItemCommand { Order = order, OrderItem = orderItem });- if (result.error)- Error(result.message);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> CancelOrderItem(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var result = await mediator.Send(new CancelOrderItemCommand { Order = order, OrderItem = orderItem });- if (result.error)- Error(result.message);- else- Success("The order item was successfully canceled");-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ResetDownloadCount(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- orderItem.DownloadCount = 0;- await orderService.UpdateOrder(order);- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ActivateDownloadItem(string id, string orderItemId)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- orderItem.IsDownloadActivated = !orderItem.IsDownloadActivated;- await orderService.UpdateOrder(order);- var model = new OrderModel();- await orderViewModelService.PrepareOrderDetailsModel(model, order);-- //selected tab- await SaveSelectedTabIndex(persistForTheNextRequest: true);-- return RedirectToAction("Edit", "Order", new { id });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> UploadLicenseFilePopup(string id, string orderItemId,- [FromServices] IProductService productService)- {- var order = await orderService.GetOrderById(id);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId) ?? throw new ArgumentException("No order item found with the specified id");- var product = await productService.GetProductByIdIncludeArch(orderItem.ProductId);-- if (!product.IsDownload)- throw new ArgumentException("Product is not downloadable");- var model = new OrderModel.UploadLicenseModel {- LicenseDownloadId = !string.IsNullOrEmpty(orderItem.LicenseDownloadId) ? orderItem.LicenseDownloadId : "",- OrderId = order.Id,- OrderItemId = orderItem.Id- };-- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> UploadLicenseFilePopup(OrderModel.UploadLicenseModel model)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == model.OrderItemId) ?? throw new ArgumentException("No order item found with the specified id");-- //attach license- orderItem.LicenseDownloadId = !string.IsNullOrEmpty(model.LicenseDownloadId) ? model.LicenseDownloadId : null;- await orderService.UpdateOrder(order);-- //success- model.RefreshPage = true;-- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> DeleteLicenseFilePopup(OrderModel.UploadLicenseModel model)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == model.OrderItemId);- if (orderItem == null)- throw new ArgumentException("No order item found with the specified id");-- //attach license- orderItem.LicenseDownloadId = null;- await orderService.UpdateOrder(order);-- return RedirectToAction("Edit", "Order", new { id = model.OrderId });- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> AddProductToOrder(string orderId)- {- var order = await orderService.GetOrderById(orderId);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId)- return RedirectToAction("List");-- var model = await orderViewModelService.PrepareAddOrderProductModel(order);- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AddProductToOrder(DataSourceRequest command, OrderModel.AddOrderProductModel model,- [FromServices] IProductService productService)- {- var categoryIds = new List<string>();- if (!string.IsNullOrEmpty(model.SearchCategoryId))- categoryIds.Add(model.SearchCategoryId);-- var gridModel = new DataSourceResult();- var products = (await productService.SearchProducts(categoryIds: categoryIds,- storeId: contextAccessor.WorkContext.CurrentCustomer.StaffStoreId,- brandId: model.SearchBrandId,- collectionId: model.SearchCollectionId,- productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,- keywords: model.SearchProductName,- pageIndex: command.Page - 1,- pageSize: command.PageSize,- showHidden: true)).products;- gridModel.Data = products.Select(x =>- {- var productModel = new OrderModel.AddOrderProductModel.ProductModel {- Id = x.Id,- Name = x.Name,- Sku = x.Sku- };-- return productModel;- });- gridModel.Total = products.TotalCount;-- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> AddProductToOrderDetails(string orderId, string productId)- {- var order = await orderService.GetOrderById(orderId);- if (order == null)- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- var model = await orderViewModelService.PrepareAddProductToOrderModel(order, productId);- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AddProductToOrderDetails(AddProductToOrderModel model)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null)- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- var warnings = await orderViewModelService.AddProductToOrderDetails(model);- if (!warnings.Any())- //redirect to order details page- return RedirectToAction("Edit", "Order", new { id = model.OrderId });-- //errors- var result = await orderViewModelService.PrepareAddProductToOrderModel(order, model.ProductId);- result.Warnings.AddRange(warnings);- return View(result);- }-- #endregion-- #endregion-- #region Addresses-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> AddressEdit(string addressId, string orderId, bool billingAddress)- {- var order = await orderService.GetOrderById(orderId);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- var address = new Address();- switch (billingAddress)- {- case true when order.BillingAddress != null:- {- if (order.BillingAddress.Id == addressId)- address = order.BillingAddress;- break;- }- case false when order.ShippingAddress != null:- {- if (order.ShippingAddress.Id == addressId)- address = order.ShippingAddress;- break;- }- }-- if (address == null)- throw new ArgumentException("No address found with the specified id", nameof(addressId));-- var model = await orderViewModelService.PrepareOrderAddressModel(order, address);- model.BillingAddress = billingAddress;- return View(model);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AddressEdit(OrderAddressModel model,- [FromServices] IAddressAttributeService addressAttributeService,- [FromServices] IAddressAttributeParser addressAttributeParser)- {- var order = await orderService.GetOrderById(model.OrderId);- if (order == null)- //No order found with the specified id- return RedirectToAction("List");-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return RedirectToAction("List");-- var address = new Address();- switch (model.BillingAddress)- {- case true when order.BillingAddress != null:- {- if (order.BillingAddress.Id == model.Address.Id)- address = order.BillingAddress;- break;- }- case false when order.ShippingAddress != null:- {- if (order.ShippingAddress.Id == model.Address.Id)- address = order.ShippingAddress;- break;- }- }-- if (ModelState.IsValid)- {- var customAttributes = await model.Address.ParseCustomAddressAttributes(addressAttributeParser, addressAttributeService);- await orderViewModelService.UpdateOrderAddress(order, address, model, customAttributes);- return RedirectToAction("AddressEdit",- new { addressId = model.Address.Id, orderId = model.OrderId, model.BillingAddress });- }-- //If we got this far, something failed, redisplay form- model = await orderViewModelService.PrepareOrderAddressModel(order, address);- return View(model);- }-- #endregion-- #region Order notes-- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> OrderNotesSelect(string orderId, DataSourceRequest command)- {- var order = await orderService.GetOrderById(orderId) ?? throw new ArgumentException("No order found with the specified id");- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return Content("");-- //order notes- var orderNoteModels = await orderViewModelService.PrepareOrderNotes(order);- var gridModel = new DataSourceResult {- Data = orderNoteModels,- Total = orderNoteModels.Count- };- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> OrderNoteAdd(string orderId, string downloadId, bool displayToCustomer,- string message)- {- var order = await orderService.GetOrderById(orderId);- if (order == null)- return Json(new { Result = false });-- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return Json(new { Result = false });-- await orderViewModelService.InsertOrderNote(order, downloadId, displayToCustomer, message);-- return Json(new { Result = true });- }-- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> OrderNoteDelete(string id, string orderId)- {- var order = await orderService.GetOrderById(orderId) ?? throw new ArgumentException("No order found with the specified id");- if (order.StoreId != contextAccessor.WorkContext.CurrentCustomer.StaffStoreId) return Json(new { Result = false });-- await orderViewModelService.DeleteOrderNote(order, id);-- return new JsonResult("");- }-- #endregion-}\ No newline at end of file+ IMediator mediator,+ IAdminDataScope<Order> scope)+ : BaseOrderManagementController(orderViewModelService, orderService, orderStatusService,+ translationService, contextAccessor, pdfService, mediator, scope);diff --git a/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs b/src/Web/Grand.Web.Vendor/Controllers/OrderController.csindex 66a810779..13ed30012 100644--- a/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs@@ -1,221 +1,33 @@-using Grand.Business.Core.Interfaces.Catalog.Products;using Grand.Business.Core.Interfaces.Checkout.Orders;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Common.Pdf;-using Grand.Domain.Permissions;using Grand.Domain.Orders;using Grand.Infrastructure;-using Grand.Web.Common.DataSource;-using Grand.Web.Common.Security.Authorization;+using Grand.Web.AdminShared.Controllers;+using Grand.Web.AdminShared.Interfaces;+using Grand.Web.Common.Filters;using Grand.Web.Vendor.Extensions;-using Grand.Web.Vendor.Interfaces;-using Grand.Web.Vendor.Models.Orders;using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Vendor.Controllers;-[PermissionAuthorize(PermissionSystemName.Orders)]-public class OrderController : BaseVendorController-{- #region Ctor-- public OrderController(- IOrderViewModelService orderViewModelService,- IOrderService orderService,- ITranslationService translationService,- IContextAccessor contextAccessor,- IPdfService pdfService)- {- _orderViewModelService = orderViewModelService;- _orderService = orderService;- _translationService = translationService;- _contextAccessor = contextAccessor;- _pdfService = pdfService;- }-- #endregion-- #region Fields-- private readonly IOrderViewModelService _orderViewModelService;- private readonly IOrderService _orderService;- private readonly ITranslationService _translationService;- private readonly IContextAccessor _contextAccessor;- private readonly IPdfService _pdfService;-- #endregion-- #region Order list-- public IActionResult Index()- {- return RedirectToAction("List");- }-- public async Task<IActionResult> List(int? orderStatusId = null,- int? paymentStatusId = null, int? shippingStatusId = null,- DateTime? startDate = null, string code = null)- {- var model = await _orderViewModelService.PrepareOrderListModel(orderStatusId, paymentStatusId, shippingStatusId,- startDate, code);- return View(model);- }-- public async Task<IActionResult> ProductSearchAutoComplete(string term,- [FromServices] IProductService productService)- {- const int searchTermMinimumLength = 3;- if (string.IsNullOrWhiteSpace(term) || term.Length < searchTermMinimumLength)- return Content("");-- //products- const int productNumber = 15;- var products = (await productService.SearchProducts(- vendorId: _contextAccessor.WorkContext.CurrentVendor.Id,- keywords: term,- pageSize: productNumber,- showHidden: true)).products;-- var result = (from p in products- select new {- label = p.Name,- productid = p.Id- })- .ToList();- return Json(result);- }-- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> OrderList(DataSourceRequest command, OrderListModel model)- {- var (orderModels, totalCount) =- await _orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = orderModels.ToList(),- Total = totalCount- };- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> GoToOrderId(OrderListModel model)- {- Order order = null;- if (int.TryParse(model.GoDirectlyToNumber, out var orderNumber))- {- order = await _orderService.GetOrderByNumber(orderNumber);- }- else- {- var orders = await _orderService.GetOrdersByCode(model.GoDirectlyToNumber);- switch (orders.Count)- {- case > 1:- return RedirectToAction("List", new { Code = model.GoDirectlyToNumber });- case 1:- order = orders.FirstOrDefault();- break;- }- }-- return RedirectToAction("Edit", "Order", new { id = order?.Id });- }-- #endregion-- #region Order details-- #region Edit, delete-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> Edit(string id)- {- var order = await _orderService.GetOrderById(id);- if (order == null || order.Deleted || !_contextAccessor.WorkContext.HasAccessToOrder(order))- //No order found with the specified id- return RedirectToAction("List");-- var model = new OrderModel();- await _orderViewModelService.PrepareOrderDetailsModel(model, order);-- return View(model);- }-- public async Task<IActionResult> PdfInvoice(string orderId)- {- var order = await _orderService.GetOrderById(orderId);- //No order found with the specified id- if (order == null || order.Deleted || !_contextAccessor.WorkContext.HasAccessToOrder(order)) return RedirectToAction("List");-- var orders = new List<Order> {- order- };- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintOrdersToPdf(stream, orders, _contextAccessor.WorkContext.WorkingLanguage.Id,- _contextAccessor.WorkContext.CurrentVendor.Id);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", $"order_{order.Id}.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceAll(OrderListModel model)- {- //load orders- var orders = await _orderViewModelService.PrepareOrders(model);- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintOrdersToPdf(stream, orders, _contextAccessor.WorkContext.WorkingLanguage.Id,- _contextAccessor.WorkContext.CurrentVendor.Id);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", "orders.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceSelected(string selectedIds)- {- var orders = new List<Order>();- if (selectedIds != null)- {- var ids = selectedIds- .Split([','], StringSplitOptions.RemoveEmptyEntries)- .Select(x => x)- .ToArray();- orders.AddRange(await _orderService.GetOrdersByIds(ids));- }-- //a vendor should have access only to his products- orders = orders.Where(_contextAccessor.WorkContext.HasAccessToOrder).ToList();-- //ensure that we at least one order selected- if (orders.Count == 0)- {- Error(_translationService.GetResource("Vendor.Orders.PdfInvoice.NoOrders"));- return RedirectToAction("List");- }-- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintOrdersToPdf(stream, orders, _contextAccessor.WorkContext.WorkingLanguage.Id,- _contextAccessor.WorkContext.CurrentVendor.Id);- bytes = stream.ToArray();- }-- return File(bytes, "application/pdf", "orders.pdf");- }-- #endregion-- #endregion-}\ No newline at end of file+// Concrete host subclass of BaseOrderController (ARCH-001 Order consolidation). Vendor gets+// read-only/list/PDF actions only - it inherits BaseOrderController directly, never+// BaseOrderManagementController, so no mutating action exists on this type at all. This class+// supplies Vendor's DI wiring plus the attributes that used to arrive transitively via+// BaseVendorController - BaseOrderController can't inherit any single host's base controller (it's+// shared across Admin/Store/Vendor, each with a different [Area]/[Authorize*] pair), so each subclass+// restates its own host's attribute set explicitly, same pattern as ProductController.+[AutoValidateAntiforgeryToken]+[Area(Constants.AreaVendor)]+[AuthorizeVendor]+[AuthorizeMenu]+public class OrderController(+ IOrderViewModelService orderViewModelService,+ IOrderService orderService,+ ITranslationService translationService,+ IContextAccessor contextAccessor,+ IPdfService pdfService,+ IAdminDataScope<Order> scope)+ : BaseOrderController(orderViewModelService, orderService, translationService, contextAccessor,+ pdfService, scope);