public async Task <IActionResult> PutMovieList(int id, MovieList movieList) { if (id != movieList.MovieListId) { return(BadRequest()); } MovieListEntry ml = new MovieListEntry { MovieId = 1, MovieListId = id }; movieList.MovieListEntries.Add(ml); _context.Entry(movieList).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieListExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutMovie(int id, Movie movie) { if (id != movie.MovieId) { return(BadRequest()); } _context.Entry(movie).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }