public ViewResult Index() { var tours = _tourCart.GetShoppedTours(); _tourCart.ShoppedTours = tours; var cartViewModel = new TourCartViewModel { TourCart = _tourCart, CartTotal = _tourCart.GetCartTotal() }; return(View(cartViewModel)); }
public IActionResult CheckOut(Order order) { var tours = _tourCart.GetShoppedTours(); _tourCart.ShoppedTours = tours; if (_tourCart.ShoppedTours.Count == 0) { ModelState.AddModelError("", "No tours in your cart. Please select some before your check out"); } if (ModelState.IsValid) { _orderRepository.AddOrder(order); _tourCart.ClearCart(); return(RedirectToAction("PostCheckOut")); } return(View(order)); }
public IViewComponentResult Invoke() { var tours = _tourCart.GetShoppedTours(); //mock data // var tours = new List<ShoppedTour>() // { // new ShoppedTour(), // new ShoppedTour() // }; _tourCart.ShoppedTours = tours; var tourCartViewModel = new TourCartViewModel { TourCart = _tourCart, CartTotal = _tourCart.GetCartTotal() }; return(View(tourCartViewModel)); }