From 251c19e3ecda39a6b0b3744a2b20608798afcd9f Mon Sep 17 00:00:00 2001 From: Vishesh Date: Thu, 4 Jan 2024 11:15:50 +0000 Subject: [PATCH] Issue405 --- .../Properties/launchSettings.json | 12 ++++++++++ .../Grand.Web/Controllers/OrderController.cs | 15 ++++++++++++ .../Views/Order/CustomerOrders.cshtml | 23 +++++++++++++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 src/Tests/Grand.Web.Common.Tests/Properties/launchSettings.json diff --git a/src/Tests/Grand.Web.Common.Tests/Properties/launchSettings.json b/src/Tests/Grand.Web.Common.Tests/Properties/launchSettings.json new file mode 100644 index 000000000..41e2fb772 --- /dev/null +++ b/src/Tests/Grand.Web.Common.Tests/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "Grand.Web.Common.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:51564;http://localhost:51565" + } + } +} \ No newline at end of file diff --git a/src/Web/Grand.Web/Controllers/OrderController.cs b/src/Web/Grand.Web/Controllers/OrderController.cs index b8c719bde..414a9a005 100644 --- a/src/Web/Grand.Web/Controllers/OrderController.cs +++ b/src/Web/Grand.Web/Controllers/OrderController.cs @@ -21,6 +21,7 @@ using Microsoft.AspNetCore.Mvc; using Grand.Web.Common.Security.Authorization; using Grand.Domain.Customers; +using MongoDB.Driver; namespace Grand.Web.Controllers { @@ -80,6 +81,19 @@ protected virtual bool IsPostBeingDone { #endregion #region Methods + + + [HttpPost] + public virtual async Task Search( int orderNumber) + { + var order = await _orderService.GetOrderByNumber(orderNumber); + if (!await order.Access(_workContext.CurrentCustomer, _groupService)) + return Challenge(); + + var model = await _mediator.Send(new GetOrderDetails { Order = order, Language = _workContext.WorkingLanguage }); + + return View("Details",model); + } //My account / Orders [HttpGet] @@ -92,6 +106,7 @@ public virtual async Task CustomerOrders(OrderPagingModel command Store = _workContext.CurrentStore, Command = command }); + return View(model); } diff --git a/src/Web/Grand.Web/Views/Order/CustomerOrders.cshtml b/src/Web/Grand.Web/Views/Order/CustomerOrders.cshtml index d40887bd0..2a7041e0c 100644 --- a/src/Web/Grand.Web/Views/Order/CustomerOrders.cshtml +++ b/src/Web/Grand.Web/Views/Order/CustomerOrders.cshtml @@ -14,8 +14,27 @@ @await Component.InvokeAsync("CustomerNavigation", new { selectedTabId = AccountNavigationEnum.Orders }) }