public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         IBL      bl       = new BLImplement();
         Medicine medicine = bl.getAllMedicines().ToList().FindAll(x => x.Id == id).FirstOrDefault();
         bl.deleteMedicine(medicine);
         ViewBag.Message = String.Format("The medicine {0} is successfully deleted", medicine.Name);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = String.Format(ex.Message);
         return(RedirectToAction("Index"));
     }
 }
Ejemplo n.º 2
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         IBL      bl       = new BLImplement();
         Medicine medicine = bl.getMedicine(id);
         bl.deleteMedicine(medicine);
         ViewBag.Message = String.Format("The medicine {0} is successfully deleted", medicine.Name);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = String.Format(ex.Message);
         return(RedirectToAction("Index"));
     }
 }