Example #1
0
        public ActionResult Delete(string isbn)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Login", "Pages"));
            }

            try
            {
                // Let's get the book first
                Book book = Book.getByISBN(isbn);

                // Let's delete the link between the book and its author(s)
                BookAuthor.delete(book.ISBN);

                // And finally, let's delete the book
                book.delete();
            }
            catch
            {
                return(View("Error500"));
            }

            return(RedirectToAction("List"));
        }