public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ReleaseDate,Genre,Price, 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("Id,Name,MovieId")] Actor actor) { if (id != actor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(actor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActorExists(actor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "Title", actor.MovieId); return(View(actor)); }