public ActionResult <Movie> EditMovie(int id, [FromBody] EditMovie editMovie) { var movieToEdit = dbContext.Movies.FirstOrDefault(x => x.MovieId == id); if (movieToEdit == null) { return(NotFound()); } movieToEdit.Title = editMovie.Title; movieToEdit.Director = editMovie.Director; dbContext.SaveChanges(); return(movieToEdit); }
public ActionResult <Movie> EditMovie(int id, [FromBody] EditMovie editMovie) { var MovieToEdit = dbContext.Movies.FirstOrDefault(option => option.ID == id); if (MovieToEdit == null) { return(NotFound()); } MovieToEdit.Title = editMovie.Title; MovieToEdit.Link = editMovie.Link; dbContext.SaveChanges(); return(MovieToEdit); }