public ActionResult AddBook(Book newBook, int?authorID) { try { bool isAuthorized = Administrator.IsAuthorized((string)(Session["UserSession"]), (int)(Session["UserRank"]), (int)Authorization.Rank.administrator); if (isAuthorized) { if (!BookManager.DoesIsbnExist(newBook.ISBN)) { if (ModelState.IsValid) { BookManager.AddABook(newBook, authorID); return(RedirectToAction("ListBooks", "Book")); } } else { TempData["Error"] = "Something went wrong!"; return(RedirectToAction("AddBook")); } } } catch (Exception ex) { TempData["Error"] = "Something went wrong!"; return(RedirectToAction("listBooks", "Book")); } TempData["Error"] = "Something went wrong!"; return(RedirectToAction("AddBook")); }