public virtual async Task <IActionResult> Wishlist(Guid?customerGuid) { if (!await _permissionService.Authorize(StandardPermissionProvider.EnableWishlist)) { return(RedirectToRoute("HomePage")); } Customer customer = customerGuid.HasValue ? await _customerService.GetCustomerByGuid(customerGuid.Value) : _workContext.CurrentCustomer; if (customer == null) { return(RedirectToRoute("HomePage")); } var cart = customer.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.Wishlist); if (!string.IsNullOrEmpty(_storeContext.CurrentStore.Id)) { cart = cart.LimitPerStore(_shoppingCartSettings.CartsSharedBetweenStores, _storeContext.CurrentStore.Id); } var model = new WishlistModel(); await _shoppingCartViewModelService.PrepareWishlist(model, cart.ToList(), !customerGuid.HasValue); return(View(model)); }
public virtual async Task <IActionResult> Wishlist(Guid?customerGuid) { if (!await _permissionService.Authorize(StandardPermissionProvider.EnableWishlist)) { return(RedirectToRoute("HomePage")); } Customer customer = customerGuid.HasValue ? await _customerService.GetCustomerByGuid(customerGuid.Value) : _workContext.CurrentCustomer; if (customer == null) { return(RedirectToRoute("HomePage")); } var cart = _shoppingCartService.GetShoppingCart(_storeContext.CurrentStore.Id, ShoppingCartType.Wishlist); var model = new WishlistModel(); await _shoppingCartViewModelService.PrepareWishlist(model, cart, !customerGuid.HasValue); return(View(model)); }
public virtual IActionResult Wishlist(Guid?customerGuid) { if (!_permissionService.Authorize(StandardPermissionProvider.EnableWishlist)) { return(RedirectToRoute("HomePage")); } Customer customer = customerGuid.HasValue ? _customerService.GetCustomerByGuid(customerGuid.Value) : _workContext.CurrentCustomer; if (customer == null) { return(RedirectToRoute("HomePage")); } var cart = customer.ShoppingCartItems .Where(sci => sci.ShoppingCartType == ShoppingCartType.Wishlist) .LimitPerStore(_storeContext.CurrentStore.Id) .ToList(); var model = new WishlistModel(); _shoppingCartViewModelService.PrepareWishlist(model, cart, !customerGuid.HasValue); return(View(model)); }