public async Task <IActionResult> Create([Bind("ArtistID,Name")] Artist artist) { if (ModelState.IsValid) { _context.Add(artist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(artist)); }
public async Task <IActionResult> Create([Bind("AlbumID,Name,NumSongs,Realease,ArtistID")] Album album) { if (ModelState.IsValid) { _context.Add(album); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ArtistID"] = new SelectList(_context.Artists, "ArtistID", "Name", album.ArtistID); return(View(album)); }