public ActionResult RentBoat(BoatRentModel boatRentModel) { if (!SessionManager.userIsLoggedIn()) { return(new HttpStatusCodeResult(403)); } if (ModelState.IsValid) { BL.Location location = MainClass.Instance.getLocations().Find(v => v.id == boatRentModel.locationId); if (location != null) { BL.Boat boat = location.getBoats().Find(v => v.id == boatRentModel.boatId); if (boat != null) { if (location.canRentBoat(boat, boatRentModel.startTime, boatRentModel.endTime, boatRentModel.numPersons)) { BL.BoatRental rental = new BL.BoatRental(boatRentModel.startTime, boatRentModel.endTime, boat, boatRentModel.numPersons); boatRentModel.totalPrice = rental.getTotalPrice(); boatRentModel.locationName = location.name; boatRentModel.boat = boat; System.Web.HttpContext.Current.Session["boatRental"] = boatRentModel; return(RedirectToAction("OrderBoatRental", "Boat")); } } } } ViewBag.Status = false; ViewBag.Message = "Boat can not be rented. Please make sure you enter the correct date and time slot " + "and number of persons not bigger than the capacity."; return(View(new BoatRentModel() { locationList = BL.MainClass.Instance.getLocations() })); }