Пример #1
0
 public ActionResult Edit(int id)
 {
     using (var productsManager = new ProductsManager())
     {
         var product = productsManager.Get(id);
         return(View(product));
     }
 }
Пример #2
0
 public ActionResult Details(int id)
 {
     using (var productsManager = new ProductsManager())
     {
         var product = productsManager.Get(id);
         product.CanEdit = CanEdit;
         product.CanAdd  = CanAdd;
         return(View(product));
     }
 }
Пример #3
0
        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));
        }