public async Task <IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("AlbumID,GenreID,ArtistID,Title,Price,AlbumArtUri")] Album album) { if (ModelState.IsValid) { _context.Add(album); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ArtistID"] = new SelectList(_context.Set <Artist>(), "ArtistID", "ArtistID", album.ArtistID); ViewData["GenreID"] = new SelectList(_context.Set <Genre>(), "GenreID", "GenreID", album.GenreID); return(View(album)); }