public async Task <IActionResult> Edit(int id, [Bind("Id,Firstname,Lastname")] Author author) { if (id != author.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await AuthorRepository.EditAuthor(author); } catch (DbUpdateConcurrencyException) { if (!AuthorExists(author.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(author)); }
public ActionResult Edit([Bind(Include = "ID,DeathDate,Age,Sex,FirstName,LastName,BornDate")] Author author) { if (ModelState.IsValid) { db1.EditAuthor(author); //db.Entry(author).State = EntityState.Modified; //db.SaveChanges(); return(RedirectToAction("Index")); } return(View(author)); }