protected virtual WishListSummaryViewModel CreateSummaryWishListViewModel(CreateWishListViewModelParam param) { var viewModel = new WishListSummaryViewModel { Items = new List <LineItemIdsViewModel>() }; var lineItems = param.WishList.GetLineItems(); if (lineItems != null) { viewModel.TotalQuantity = lineItems.Count; foreach (var item in lineItems) { viewModel.Items.Add(new LineItemIdsViewModel { Id = item.Id, ProductId = item.ProductId, VariantId = item.VariantId }); } } viewModel.SignInUrl = WishListUrlProvider.GetSignInUrl(new GetWishListUrlParam { BaseUrl = param.BaseUrl, CultureInfo = param.CultureInfo }); return(viewModel); }
protected virtual async Task <WishListViewModel> CreateWishListViewModelAsync(CreateWishListViewModelParam param) { var viewModel = new WishListViewModel(); var lineItems = param.WishList.GetLineItems(); if (lineItems != null) { var imageInfo = new ProductImageInfo { ImageUrls = await ImageService.GetImageUrlsAsync(lineItems).ConfigureAwait(false), }; viewModel.Items = LineItemViewModelFactory.CreateViewModel(new CreateListOfLineItemDetailViewModelParam { Cart = param.WishList, LineItems = lineItems, CultureInfo = param.CultureInfo, ImageInfo = imageInfo, BaseUrl = param.BaseUrl }).ToList(); viewModel.Items.Reverse(); viewModel.TotalQuantity = lineItems.Count; } var getUrlParam = new GetWishListUrlParam { BaseUrl = param.BaseUrl, CultureInfo = param.CultureInfo }; viewModel.SignInUrl = WishListUrlProvider.GetSignInUrl(getUrlParam); viewModel.ShareUrl = viewModel.TotalQuantity == 0 ? string.Empty: WishListUrlProvider.GetShareUrl(new GetShareWishListUrlParam { BaseUrl = param.BaseUrl, CultureInfo = param.CultureInfo, CustomerId = param.WishList.CustomerId, Scope = param.WishList.ScopeId, WebsiteId = param.WebsiteId }); return(viewModel); }