public ActionResult Checkout(Book book) { string submit = Session["submit"].ToString(); if (submit == "Checkout") { if (rentalManager.AddNewRental(book, ((AccessToken)Session["AccessToken"]).User)) { return(RedirectToAction("Details", "Book", book)); } else { ModelState.AddModelError("", "Could not checkout book"); return(View(book)); } } else if (submit == "Return Book") { if (rentalManager.DeleteRental(book, ((AccessToken)Session["AccessToken"]).User)) { return(RedirectToAction("Details", "Book", book)); } else { ModelState.AddModelError("", "Could not return book"); return(View(book)); } } else { return(View(book)); } }