public ActionResult DeleteConfirmed(int id) { var model = new MakesViewModel(); try { Make make = db.Makes.Find(id); db.Makes.Remove(make); db.SaveChanges(); } catch { model.ErrorMessage = "You cannot delete a Make that is currently being referenced by one or more Users."; } return RedirectToAction("Index", model); }
// GET: Makes public ActionResult Index(MakesViewModel model) { model.Makes = db.Makes.ToList(); return View(model); }