public ActionResult Edit(EditBookViewModel model) { var book = mapper.Map <EditBookViewModel, Book>(model); model.SetAuthors(authors.GetAll().ToList()); model.SetCities(cities.GetAll().ToList()); model.SetPublishings(publishings.GetAll().ToList()); try { if (ModelState.IsValid) { if (books.Edit(book)) { return(RedirectToAction("Index")); } } return(View(model)); } catch { return(View(model)); } }
public bool PutBook(Book book) { return(books.Edit(book)); }