public virtual IActionResult Cart(bool checkoutAttributes) { if (!_permissionService.Authorize(StandardPermissionProvider.EnableShoppingCart)) { return(RedirectToRoute("HomePage")); } var cart = _workContext.CurrentCustomer.ShoppingCartItems .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart || sci.ShoppingCartType == ShoppingCartType.Auctions) .LimitPerStore(_storeContext.CurrentStore.Id) .ToList(); var model = new ShoppingCartModel(); _shoppingCartViewModelService.PrepareShoppingCart(model, cart, validateCheckoutAttributes: checkoutAttributes); return(View(model)); }
public virtual async Task <IActionResult> Cart(bool checkoutAttributes) { if (!await _permissionService.Authorize(StandardPermissionProvider.EnableShoppingCart)) { return(RedirectToRoute("HomePage")); } var cart = _shoppingCartService.GetShoppingCart(_storeContext.CurrentStore.Id, ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions); var model = new ShoppingCartModel(); await _shoppingCartViewModelService.PrepareShoppingCart(model, cart, validateCheckoutAttributes : checkoutAttributes); return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync(bool?prepareAndDisplayOrderReviewData, ShoppingCartModel overriddenModel) { //use already prepared (shared) model if (overriddenModel != null) { return(View(overriddenModel)); } var cart = _shoppingCartService.GetShoppingCart(_storeContext.CurrentStore.Id, ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions); var model = new ShoppingCartModel(); await _shoppingCartViewModelService.PrepareShoppingCart(model, cart, isEditable : false, prepareAndDisplayOrderReviewData : prepareAndDisplayOrderReviewData.GetValueOrDefault()); return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync(bool?prepareAndDisplayOrderReviewData, ShoppingCartModel overriddenModel) { //use already prepared (shared) model if (overriddenModel != null) { return(View(overriddenModel)); } var cart = _workContext.CurrentCustomer.ShoppingCartItems .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart || sci.ShoppingCartType == ShoppingCartType.Auctions) .LimitPerStore(_storeContext.CurrentStore.Id) .ToList(); var model = new ShoppingCartModel(); await Task.Run(() => _shoppingCartViewModelService.PrepareShoppingCart(model, cart, isEditable: false, prepareAndDisplayOrderReviewData: prepareAndDisplayOrderReviewData.GetValueOrDefault())); return(View(model)); }