public ActionResult Create()
        {
            var bookViewModel = new BookDetailsViewModel();

            bookViewModel.PublisherList = PublisherBLL.ListAll();
            bookViewModel.AuthorsList   = AuthorBLL.ListAll();
            return(View(bookViewModel));
        }
        public ActionResult Create(BookDetailsViewModel bookViewModel)
        {
            if (ModelState.IsValid)
            {
                var bookModel = this.ConvertBookDetailsViewModelToBookModel(bookViewModel);

                BookBLL.Insert(bookModel);
                return(RedirectToAction("Index"));
            }

            bookViewModel.PublisherList = PublisherBLL.ListAll();
            bookViewModel.AuthorsList   = AuthorBLL.ListAll();

            return(View(bookViewModel));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BookModel book = BookBLL.FindBookById(id.Value);

            if (book == null)
            {
                return(HttpNotFound());
            }

            var bookViewModel = new BookDetailsViewModel(book);

            bookViewModel.BookID        = id.Value;
            bookViewModel.PublisherList = PublisherBLL.ListAll();
            bookViewModel.AuthorsList   = AuthorBLL.ListAll();

            return(View(bookViewModel));
        }