Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
 public bool PutBook(Book book)
 {
     return(books.Edit(book));
 }