public ActionResult Delete(Purchase purchase) { try { var aPurchase = _purchaseBll.GetPurchaseById(purchase.Id); if (aPurchase != null) { var isDelete = _purchaseBll.Delete(aPurchase); if (isDelete) { ViewBag.SDeleted = "Delete Success."; } else { ViewBag.NSDelete = "Delete Failed."; } } else { ViewBag.FMsg = "Purchase not found."; } } catch (Exception exception) { ViewBag.FMsg = exception.Message; } return(View()); }
// GET: Items/Edit/5 //public ActionResult Edit(int? id) //{ // if (id == null) // { // return RedirectToAction("Error", "Home"); // } // Purchase purchase = purchaseBll.GetById(id); // if (purchase == null) // { // return RedirectToAction("Error", "Home"); // } // ViewBag.OutletId = purchaseBll.GetOutlet(); // ViewBag.EmployeeId = purchaseBll.GetEmployee(); // return View(purchase); //} //// POST: Items/Edit/5 //[HttpPost] //public ActionResult Edit(Purchase purchase) //{ // if (ModelState.IsValid) // { // status = purchaseBll.Edit(purchase); // if (status == true) // { // return RedirectToAction("List", "Purchases"); // } // else // { // ViewBag.Message = "Purchase is not updated succesfully"; // } // } // ViewBag.OutletId = purchaseBll.GetOutlet(); // ViewBag.EmployeeId = purchaseBll.GetEmployee(); // return View(purchase); //} // GET: Items/Delete/5 public JsonResult Delete(int id) { status = purchaseBll.Delete(id); if (status == true) { return(Json(1)); } return(Json(0)); }