in app/Controllers/HomeController.cs [133:162]
public async Task<IActionResult> Edit(int id, [Bind("Id,Title,Year,Genre,Director")] Movie movie)
{
if (id != movie.Id)
{
return NotFound();
}
if (ModelState.IsValid)
{
try
{
_context.Update(movie);
await _context.SaveChangesAsync();
_logger.LogInformation($"Movie Id: {movie.Id}, Title: {movie.Title} is updated by {_userManager.GetUserName(User)}.");
}
catch (DbUpdateConcurrencyException)
{
if (!_context.Movie.Any(e => e.Id == movie.Id))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(movie);
}