public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ReleaseDate,Genre,Rating")] Movie movie) { if (id != movie.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movie); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(movie.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Edit(int id, [Bind("MovieID,Category,Title,Year,Director,Rating,LentTo,Edited,Notes")] Movie movie) { if (id != movie.MovieID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movie); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(movie.MovieID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(ViewMovies))); //updates the movie object based on the movieId and redirects you to the movie list } return(View(movie)); }