private IEnumerable <FashionVariant> GetVariants(FashionBundle currentContent) { return(_contentLoader .GetItems(currentContent.GetEntries(_relationRepository), _languageResolver.GetPreferredCulture()) .OfType <FashionVariant>() .Where(v => v.IsAvailableInCurrentMarket(_currentMarket) && !_filterPublished.ShouldFilter(v)) .ToArray()); }
public virtual FashionBundleViewModel Create(FashionBundle currentContent) { return(new FashionBundleViewModel { Bundle = currentContent, Images = currentContent.GetAssets <IContentImage>(_contentLoader, _urlResolver), Entries = _catalogContentService.GetVariants <FashionVariant>(currentContent).ToList() }); }
public virtual FashionBundleViewModel Create(FashionBundle currentContent) { var variants = GetVariants(currentContent).ToList(); var viewModel = new FashionBundleViewModel { Bundle = currentContent, Images = currentContent.GetAssets <IContentImage>(_contentLoader, _urlResolver), Entries = variants }; return(viewModel); }
public ActionResult Index(FashionBundle currentContent, bool useQuickview = false) { var viewModel = _viewModelFactory.Create(currentContent); if (_isInEditMode && !viewModel.Entries.Any()) { var emptyViewName = "BundleWithoutEntries"; return(Request.IsAjaxRequest() ? PartialView(emptyViewName, viewModel) : (ActionResult)View(emptyViewName, viewModel)); } if (useQuickview) { return(PartialView("_Quickview", viewModel)); } return(Request.IsAjaxRequest() ? PartialView(viewModel) : (ActionResult)View(viewModel)); }
public ActionResult Index(FashionBundle currentContent, bool useQuickview = false) { var viewModel = _viewModelFactory.Create(currentContent); if (_isInEditMode && !viewModel.Entries.Any()) { var emptyViewName = "BundleWithoutEntries"; return(Request.IsAjaxRequest() ? PartialView(emptyViewName, viewModel) : (ActionResult)View(emptyViewName, viewModel)); } if (useQuickview) { return(PartialView("_Quickview", viewModel)); } viewModel.AlternativeProducts = this.GetAlternativeProductsRecommendations().Take(3); viewModel.CrossSellProducts = this.GetCrossSellProductsRecommendations(); return(Request.IsAjaxRequest() ? PartialView(viewModel) : (ActionResult)View(viewModel)); }
public async Task <ActionResult> Index(FashionBundle currentContent, bool useQuickview = false) { var viewModel = _viewModelFactory.Create(currentContent); if (_isInEditMode && !viewModel.Entries.Any()) { var emptyViewName = "BundleWithoutEntries"; return(Request.IsAjaxRequest() ? PartialView(emptyViewName, viewModel) : (ActionResult)View(emptyViewName, viewModel)); } var trackingResults = await _recommendationService.TrackProductAsync(HttpContext, currentContent.Code, useQuickview); if (useQuickview) { return(PartialView("_Quickview", viewModel)); } viewModel.AlternativeProducts = trackingResults?.GetAlternativeProductsRecommendations(_referenceConverter).Take(3); viewModel.CrossSellProducts = trackingResults?.GetCrossSellProductsRecommendations(_referenceConverter); return(Request.IsAjaxRequest() ? PartialView(viewModel) : (ActionResult)View(viewModel)); }
public virtual IEnumerable <T> GetVariants <T>(FashionBundle currentContent) where T : VariationContent { return(GetVariants <T>(currentContent.GetEntries(_relationRepository), _languageResolver.GetPreferredCulture())); }