public ActionResult Create() { var getListOfAuthors = Mapper.Map<List<BLLAuthor>, List<AuthorForBookModel>>(authorService.GetAllAuthorsEntities().ToList()); ViewBag.ListOfGenres = Mapper.Map<List<BLLGenre>, List<UIGenre>>(genreService.GetAllGenreEntities().ToList()); var view = new BookCreateModel() { ListOfAuthors = getListOfAuthors, IsCreatingNow = true }; return View(view); }
public ActionResult Edit(BookCreateModel book, int[] selectedGenres) { bookService.UpdateBook(Mapper.Map<BookCreateModel, BLLBook>(book),selectedGenres); return RedirectToAction("Index"); }