public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Genre genre) { if (id != genre.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(genre); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GenreExists(genre.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public async Task <IActionResult> Edit(int id, [Bind("RecordId,Artist,Title,Year,NumOfTracks")] Record record) { if (id != record.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(record); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RecordExists(record.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(record)); }