public void UpdateMovie(Movie movie) { var dbMovie = FindMovie(movie.Id); dbMovie.Name = movie.Name; dbMovie.Director = movie.Director; dbMovie.ReleaseDate = movie.ReleaseDate; _db.SaveChanges(); }
public ActionResult Create(Movie movie) { try { _repo.Add<Movie>(movie); _repo.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public void CreateMovie(Movie movie) { _db.Movies.Add(movie); _db.SaveChanges(); }
public ActionResult Edit(int id, Movie movie) { try { movie.Id = id; var dbMove = _repo.Find<Movie>(id); dbMove.Name = movie.Name; dbMove.ReleaseDate = movie.ReleaseDate; dbMove.Director = movie.Director; _repo.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }