public ActionResult Create(Car car) { // TODO: Add insert logic here if (ModelState.IsValid) { _db.Cars.Add(car); _db.SaveChanges(); return RedirectToAction("Index"); } return View(); }
public ActionResult Edit(Car car) { // TODO: Add update logic here if (ModelState.IsValid) { _db.Cars.Attach(car); _db.Entry<Car>(car).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return RedirectToAction("Index"); } return View(); }