public ViewResult Index() { var items = _reservedItem.GetReservation(); _reservedItem.Reservations = items; var reservedItemViewModel = new ReservedItemViewModel { ReservedItem = _reservedItem, ReservationTotal = _reservedItem.GetReservationTotal() }; return(View(reservedItemViewModel)); }
public IActionResult Checkout(Rental rental) { var items = _reservedItem.GetReservation(); _reservedItem.Reservations = items; if (_reservedItem.Reservations.Count == 0) { ModelState.AddModelError("", "Your cart is empty, add some reservations first!"); } if (ModelState.IsValid) { _rentalRepository.CreateRental(rental); _reservedItem.ClearCart(); return(RedirectToAction("CheckoutComplete")); } return(View(rental)); }