From 71f279c08d0bd58947acd2190610438f94307009 Mon Sep 17 00:00:00 2001 From: skoshelev Date: Wed, 25 Apr 2018 13:25:12 +0300 Subject: [PATCH] #1897 Further changes on "Refactoring of controllers in the admin area" --- .../Admin/Controllers/CurrencyController.cs | 12 +++++----- .../Controllers/MessageTemplateController.cs | 8 +++---- .../Admin/Controllers/ProductController.cs | 24 +++++++++---------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/Presentation/Nop.Web/Areas/Admin/Controllers/CurrencyController.cs b/src/Presentation/Nop.Web/Areas/Admin/Controllers/CurrencyController.cs index f22c6a95884..f495102bd39 100644 --- a/src/Presentation/Nop.Web/Areas/Admin/Controllers/CurrencyController.cs +++ b/src/Presentation/Nop.Web/Areas/Admin/Controllers/CurrencyController.cs @@ -226,10 +226,10 @@ public virtual IActionResult Create(CurrencyModel model, bool continueEditing) SuccessNotification(_localizationService.GetResource("Admin.Configuration.Currencies.Added")); - if (continueEditing) - return RedirectToAction("Edit", new { id = currency.Id }); + if (!continueEditing) + return RedirectToAction("List"); - return RedirectToAction("List"); + return RedirectToAction("Edit", new { id = currency.Id }); } //prepare model @@ -292,10 +292,10 @@ public virtual IActionResult Edit(CurrencyModel model, bool continueEditing) SuccessNotification(_localizationService.GetResource("Admin.Configuration.Currencies.Updated")); - if (continueEditing) - return RedirectToAction("Edit", new { id = currency.Id }); + if (!continueEditing) + return RedirectToAction("List"); - return RedirectToAction("List"); + return RedirectToAction("Edit", new { id = currency.Id }); } //prepare model diff --git a/src/Presentation/Nop.Web/Areas/Admin/Controllers/MessageTemplateController.cs b/src/Presentation/Nop.Web/Areas/Admin/Controllers/MessageTemplateController.cs index c854c83c426..245d3c3bd17 100644 --- a/src/Presentation/Nop.Web/Areas/Admin/Controllers/MessageTemplateController.cs +++ b/src/Presentation/Nop.Web/Areas/Admin/Controllers/MessageTemplateController.cs @@ -192,12 +192,10 @@ public virtual IActionResult Edit(MessageTemplateModel model, bool continueEditi SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.MessageTemplates.Updated")); - if (continueEditing) - { - return RedirectToAction("Edit", new { id = messageTemplate.Id }); - } + if (!continueEditing) + return RedirectToAction("List"); - return RedirectToAction("List"); + return RedirectToAction("Edit", new { id = messageTemplate.Id }); } //prepare model diff --git a/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs b/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs index 638eccffce6..522e2c6246d 100644 --- a/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs +++ b/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs @@ -2609,17 +2609,17 @@ public virtual IActionResult ProductAttributeMappingCreate(ProductAttributeMappi SuccessNotification(_localizationService.GetResource("Admin.Catalog.Products.ProductAttributes.Attributes.Added")); - if (continueEditing) + if (!continueEditing) { - //selected tab - SaveSelectedTabName(); + SaveSelectedTabName("tab-product-attributes"); - return RedirectToAction("ProductAttributeMappingEdit", new { id = productAttributeMapping.Id }); + return RedirectToAction("Edit", new { id = product.Id }); } - SaveSelectedTabName("tab-product-attributes"); + //selected tab + SaveSelectedTabName(); - return RedirectToAction("Edit", new { id = product.Id }); + return RedirectToAction("ProductAttributeMappingEdit", new { id = productAttributeMapping.Id }); } public virtual IActionResult ProductAttributeMappingEdit(int id) @@ -2699,17 +2699,17 @@ public virtual IActionResult ProductAttributeMappingEdit(ProductAttributeMapping SuccessNotification(_localizationService.GetResource("Admin.Catalog.Products.ProductAttributes.Attributes.Updated")); - if (continueEditing) + if (!continueEditing) { - //selected tab - SaveSelectedTabName(); + SaveSelectedTabName("tab-product-attributes"); - return RedirectToAction("ProductAttributeMappingEdit", new { id = productAttributeMapping.Id }); + return RedirectToAction("Edit", new { id = product.Id }); } - SaveSelectedTabName("tab-product-attributes"); + //selected tab + SaveSelectedTabName(); - return RedirectToAction("Edit", new { id = product.Id }); + return RedirectToAction("ProductAttributeMappingEdit", new { id = productAttributeMapping.Id }); } [HttpPost]