public ActionResult Create(Movie movie) { if (ModelState.IsValid) { _db.Movies.Add(movie); _db.SaveChanges(); return RedirectToAction("Index"); } return View(); }
public ActionResult Edit(int id, Movie movie) { if (ModelState.IsValid) { var dbMovie = (from m in _db.Movies where m.Id == id select m).FirstOrDefault(); dbMovie.Title = movie.Title; dbMovie.Director = movie.Director; _db.SaveChanges(); return RedirectToAction("Index"); } return View(); }