public async Task <IActionResult> Edit(int id, [Bind("BookID,Name,Author,Photo,YearOfPublishing")] Book book) { if (id != book.BookID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.BookID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("ClientID,Name,Age,LibraryID,BookID")] Client client) { if (id != client.ClientID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.ClientID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookID"] = new SelectList(_context.Book, "BookID", "Author", client.BookID); return(View(client)); }