//EndDocSection:Constructor //DocSection:DisplayCart /// <summary> /// Displays the current site's shopping cart. /// </summary> public ActionResult ShoppingCart() { // Gets the current user's shopping cart ShoppingCart currentCart = shoppingService.GetCurrentShoppingCart(); // Initializes the shopping cart model ShoppingCartViewModel model = new ShoppingCartViewModel { // Assigns the current shopping cart to the model Cart = currentCart, RemainingAmountForFreeShipping = pricingService.CalculateRemainingAmountForFreeShipping(currentCart) }; // Displays the shopping cart return(View(model)); }
/// <summary> /// Creates view model for Shopping cart step. /// </summary> public CartViewModel PrepareCartViewModel(IEnumerable <string> appliedCouponCodes = null) { var cart = mShoppingService.GetCurrentShoppingCart(); return(new CartViewModel { Cart = cart, RemainingAmountForFreeShipping = mPricingService.CalculateRemainingAmountForFreeShipping(cart), AppliedCouponCodes = appliedCouponCodes ?? cart.AppliedCouponCodes }); }
/// <summary> /// Creates view model for Shopping cart step. /// </summary> public CartViewModel PrepareCartViewModel(string couponCode = null) { var cart = mShoppingService.GetCurrentShoppingCart(); return(new CartViewModel { Cart = cart, RemainingAmountForFreeShipping = mPricingService.CalculateRemainingAmountForFreeShipping(cart), CouponCode = couponCode ?? cart.CouponCode }); }