public async Task <IActionResult> Edit(int id, [Bind("ID,Title,ReleaseDate,Genre,Price,Rating,Image")] 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("MovieRoleID,ActorID,MovieID,Character")] MovieRole movieRole) { if (id != movieRole.MovieRoleID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movieRole); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieRoleExists(movieRole.MovieRoleID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ActorID"] = new SelectList(_context.Actor, "ActorID", "Name", movieRole.ActorID); ViewData["MovieID"] = new SelectList(_context.Movie, "ID", "Genre", movieRole.MovieID); return(View(movieRole)); }
public async Task <IActionResult> Edit(int id, [Bind("ActorID, Name, BirthName, BirthDate, HomeTown")] Actor actor) { if (id != actor.ActorID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(actor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActorExists(actor.ActorID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(actor)); }