public async Task <IActionResult> Edit(string id, [Bind("Id,Name,Author, reader, comment")] 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)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,name,sirname,age,interests")] People people) { if (id != people.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(people); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PeopleExists(people.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(people)); }