public async Task <IActionResult> Create([Bind("Id,Name,Website")] Director director) { if (ModelState.IsValid) { _context.Add(director); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(director)); }
public async Task <IActionResult> Create([Bind("Id,Name,Genres,DirectorId,ReleaseYear")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DirectorId"] = new SelectList(_context.Director, "Id", "Id", movie.DirectorId); return(View(movie)); }
public async Task <IActionResult> Create([Bind("Id,ActorId,MovieId")] MovieCastAssignment movieCastAssignment) { if (ModelState.IsValid) { _context.Add(movieCastAssignment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ActorId"] = new SelectList(_context.Actor, "Id", "Id", movieCastAssignment.ActorId); ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "Id", movieCastAssignment.MovieId); return(View(movieCastAssignment)); }