public ActionResult Create(Book book) { if (ModelState.IsValid) { db.Books.Add(book); db.SaveChanges(); return RedirectToAction("Index"); } return View(book); }
public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Book book) { var dbBook = db.Books.FirstOrDefault(x => x.BookId == book.BookId); dbBook.Author = book.Author; dbBook.Description = book.Description; dbBook.ISBN = book.ISBN; dbBook.Title = book.Title; dbBook.WebSite = book.WebSite; db.SaveChanges(); return RedirectToAction("Index"); return View(book); }