public bool UpdateMovie(int movieId, Model.Movie movie) { if (movie == null) { throw new ArgumentNullException("movie"); } using (var db = new MoviesContext()) { var movieToUpdate = db.Movies.Where(x => x.MovieId == movie.MovieId).FirstOrDefault(); if (movieToUpdate != null) { movieToUpdate.Title = movie.Title;//perform validations. movieToUpdate.Genre = movie.Genre; movieToUpdate.ReleaseDate = movie.ReleaseDate; movieToUpdate.Rating = movie.Rating; db.Entry(movieToUpdate).State = EntityState.Modified; db.SaveChanges(); return true; } else return false; } }