public ActionResult Edit(BookModel model) { if (ModelState.IsValid) { var book = Mapper.Map<BookModel, Book>(model); new BookRepository().Save(book); return RedirectToAction("Index", "Home", new { message = (int)BooksListSuccessMessage.BookEditedSuccesfully }); } return Edit(model.Id); }
public ActionResult Add(BookModel model) { if (ModelState.IsValid) { var book = Mapper.Map<BookModel, Book>(model); new BookRepository().Insert(book); return RedirectToAction("Index", "Home", new { message = (int)BooksListSuccessMessage.BookAddedSuccesfully }); } return Add(); }