Example #1
0
        public ActionResult Delete(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;

            return(View(bookViewModel));
        }
Example #2
0
        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));
        }
 /// <summary>
 /// Find and return a book according to the id parameter
 /// </summary>
 /// <param name="id">The book id used as filter</param>
 /// <returns>The found book</returns>
 public Book FindBookById(int id)
 {
     return(BookBLL.FindBookById(id));
 }