public ActionResult Delete(int id) { var lienhe = db.LIENHEs.FirstOrDefault(m => m.ID == id); if (lienhe == null) { return(RedirectToAction("Index", "Contact")); } var xoa = new DeleteContactFormModel(); xoa.IDLienHe = lienhe.ID; return(View(xoa)); }
public ActionResult Delete(DeleteContactFormModel model) { var lienhe = db.LIENHEs.FirstOrDefault(m => m.ID == model.IDLienHe); if (lienhe == null) { return(RedirectToAction("Index", "Contact")); } db.LIENHEs.Remove(lienhe); db.SaveChanges(); return(RedirectToAction("Index", "Contact")); }