public ActionResult Edit(Book book) { if (ModelState.IsValid) { client.ModifyBook(book); return RedirectToAction("Index"); } return View(book); }
public ActionResult Create(Book book) { if (ModelState.IsValid) { client.AddBook(book); return RedirectToAction("Index"); } return View(book); }
public bool ModifyBook(Book book) { db.Entry(book).State = EntityState.Modified; db.SaveChanges(); return true; }
public bool AddBook(Book book) { db.Books.Add(book); db.SaveChanges(); return true; }