public ActionResult Create(Car car) { if (ModelState.IsValid) { db.Cars.Add(car); db.SaveChanges(); return RedirectToAction("Index"); } return View(car); }
public ActionResult Edit(Car car) { if (ModelState.IsValid) { db.Entry(car).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(car); }