public async Task <IActionResult> Edit(int id, [Bind("AlbumId,GenreId,ArtistId,Title,Price,AlbumArtUrl")] 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))); } ViewData["ArtistId"] = new SelectList(_context.Artist, "ArtistId", "Name", album.ArtistId); ViewData["GenreId"] = new SelectList(_context.Genre, "GenreId", "GenreId", album.GenreId); return(View(album)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderId,OrderDate,UserName,FirstName,LastName,Address,City,ProvinceCode,PostalCode,CountryCode,Phone,Email,Total")] Order order) { if (id != order.OrderId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.OrderId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CountryCode"] = new SelectList(_context.Country, "CountryCode", "CountryCode", order.CountryCode); ViewData["ProvinceCode"] = new SelectList(_context.Province, "ProvinceCode", "ProvinceCode", order.ProvinceCode); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Genere,Album,Artist,ReleaseDate")] Song song) { if (id != song.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(song); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SongExists(song.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(song)); }
public async Task <IActionResult> Edit(int id, [Bind("ArtistId,Name")] 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)); }