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
Change currency - more user friendly URL address #145
KrzysztofPajak311de8db8df9
diff --git a/src/Web/Grand.Web/Controllers/CommonController.cs b/src/Web/Grand.Web/Controllers/CommonController.csindex a950bb247..b3ec782bf 100644--- a/src/Web/Grand.Web/Controllers/CommonController.cs+++ b/src/Web/Grand.Web/Controllers/CommonController.cs@@ -210,9 +210,9 @@ namespace Grand.Web.Controllerspublic virtual async Task<IActionResult> SetCurrency([FromServices] ICurrencyService currencyService,[FromServices] IUserFieldService userFieldService,- string customerCurrency, string returnUrl = "")+ string currencyCode, string returnUrl = ""){- var currency = await currencyService.GetCurrencyById(customerCurrency);+ var currency = await currencyService.GetCurrencyByCode(currencyCode);if (currency != null)await _workContext.SetWorkingCurrency(currency);diff --git a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web/Endpoints/EndpointProvider.csindex a07b31a4f..8e06d19b5 100644--- a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs+++ b/src/Web/Grand.Web/Endpoints/EndpointProvider.cs@@ -345,7 +345,7 @@ namespace Grand.Web.Endpoints//change currencyendpointRouteBuilder.MapControllerRoute("ChangeCurrency",- pattern + "changecurrency/{customercurrency}",+ pattern + "changecurrency/{currencycode}",new { controller = "Common", action = "SetCurrency" });//change languagediff --git a/src/Web/Grand.Web/Views/Shared/_Selector_Currency.cshtml b/src/Web/Grand.Web/Views/Shared/_Selector_Currency.cshtmlindex efb1de5f9..26654b85b 100644--- a/src/Web/Grand.Web/Views/Shared/_Selector_Currency.cshtml+++ b/src/Web/Grand.Web/Views/Shared/_Selector_Currency.cshtml@@ -33,7 +33,7 @@ var currencyModel = new CurrencyModel{Name = x.Name,Text = x.CurrencyCode,- Value = Url.RouteUrl("ChangeCurrency", new { customercurrency = x.Id, returnUrl }),+ Value = Url.RouteUrl("ChangeCurrency", new { currencyCode = x.CurrencyCode, returnUrl }),Selected = x.Id.Equals(workContext.WorkingCurrency.Id)});<b-dropdown class="mr-2" text="@currencies.FirstOrDefault(x => x.Selected).Text">