public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Address,Password")] Member member) { if (id != member.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(member); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MemberExists(member.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(member)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Author,ReleaseDate,Genre")] Book book) { if (id != book.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(book)); }