public async Task <IActionResult> Edit(int id, [Bind("ArtistId,ArtistName,YearEstablished")] Artist artist) { if (id != artist.ArtistId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(artist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArtistExists(artist.ArtistId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(artist)); }
public async Task <IActionResult> Edit(int id, [Bind("AlbumId,Title")] Album album) { if (id != album.AlbumId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(album); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlbumExists(album.AlbumId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(album)); }