public ActionResult Delete(int id) { var slide = db.SLIDEs.FirstOrDefault(m => m.IDSlide == id); if (slide == null) { return(RedirectToAction("Index", "Order")); } var xoa = new DeleteSlideFormModel(); xoa.IDSlide = slide.IDSlide; return(View(xoa)); }
public ActionResult Delete(DeleteSlideFormModel model) { var slide = db.SLIDEs.FirstOrDefault(m => m.IDSlide == model.IDSlide); if (slide == null) { return(RedirectToAction("Index", "Slide")); } db.SLIDEs.Remove(slide); db.SaveChanges(); return(RedirectToAction("Index", "Slide")); }