コード例 #1
0
 public ActionResult Edit(int id, StudentEntities.Entities.Product model)
 {
     try
     {
         var edited = _productComponent.EditProdcut(id, model);
         return(RedirectToAction(nameof(DisplayProducts), _productComponent.GetProducts()));
     }
     catch
     {
         return(View());
     }
 }
コード例 #2
0
 public ActionResult Delete(int id, StudentEntities.Entities.Product model)
 {
     try
     {
         // TODO: Add delete logic here
         _productComponent.DeleteProduct(id);
         return(RedirectToAction(nameof(DisplayProducts), _productComponent.GetProducts()));
     }
     catch
     {
         return(View());
     }
 }
コード例 #3
0
 public ActionResult Create(StudentEntities.Entities.Product model)
 {
     try
     {
         // TODO: Add insert logic here
         var added = _productComponent.AddProduct(model);
         return(RedirectToAction(nameof(DisplayProducts), _productComponent.GetProducts()));
     }
     catch (Exception e)
     {
         return(View());
     }
 }