diff --git a/MyShop/MyShop.WebUI/Controllers/ProductCategoryManagerController.cs b/MyShop/MyShop.WebUI/Controllers/ProductCategoryManagerController.cs index dc2e38a..bec7555 100644 --- a/MyShop/MyShop.WebUI/Controllers/ProductCategoryManagerController.cs +++ b/MyShop/MyShop.WebUI/Controllers/ProductCategoryManagerController.cs @@ -1,4 +1,5 @@ -using MyShop.Core.Models; +using MyShop.Core.Contracts; +using MyShop.Core.Models; using MyShop.DataAccess.InMemory; using System; using System.Collections.Generic; @@ -10,11 +11,11 @@ namespace MyShop.WebUI.Controllers { public class ProductCategoryManagerController : Controller { - InMemoryRepository context; + IRepository context; - public ProductCategoryManagerController() + public ProductCategoryManagerController(IRepository context) { - context = new InMemoryRepository(); + this.context = context; } // GET: ProductManager public ActionResult Index() @@ -110,6 +111,7 @@ public ActionResult ConfirmDelete(string Id) else { context.Delete(Id); + context.Commit(); return RedirectToAction("Index"); } } diff --git a/MyShop/MyShop.WebUI/Controllers/ProductManagerController.cs b/MyShop/MyShop.WebUI/Controllers/ProductManagerController.cs index e791ff8..e2fc8a6 100644 --- a/MyShop/MyShop.WebUI/Controllers/ProductManagerController.cs +++ b/MyShop/MyShop.WebUI/Controllers/ProductManagerController.cs @@ -116,6 +116,7 @@ public ActionResult ConfirmDelete(string Id) { else { context.Delete(Id); + context.Commit(); return RedirectToAction("Index"); } }