예제 #1
0
        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);
        }
예제 #2
0
        // GET: Makes
        public ActionResult Index(MakesViewModel model)
        {
            model.Makes = db.Makes.ToList();

            return View(model);
        }