public ActionResult Edit(int id) { using (var productsManager = new ProductsManager()) { var product = productsManager.Get(id); return(View(product)); } }
public ActionResult Details(int id) { using (var productsManager = new ProductsManager()) { var product = productsManager.Get(id); product.CanEdit = CanEdit; product.CanAdd = CanAdd; return(View(product)); } }
public string Delete(int id) { var productName = ""; using (var productsManager = new ProductsManager()) { productName = productsManager.Get(id).Name; productsManager.Delete(id); } return(string.Format("Product '{0}' successfully deleted!", productName)); }