public ActionResult Create(Movie newMovie) { if (ModelState.IsValid) { db.Movies.Add(newMovie); db.SaveChanges(); return RedirectToAction(_Index); } else { return View(newMovie); } }
public ActionResult Edit(Movie model) { try { var movie = db.Movies.Find(model.ID); UpdateModel(movie); db.SaveChanges(); return RedirectToAction("Details", new { id = model.ID }); } catch (Exception) { ModelState.AddModelError("", "Edit Failure, see inner exception"); } return View(model); }