/// <summary>
        /// Build the mixed block view model
        /// </summary>
        /// <param name="blockModel">The current mixed block</param>
        /// <returns>Return the mixed block view model</returns>
        public virtual ProductsAndBannerBlockViewModel Build(BlockModel blockModel)
        {
            var sectionBanners  = _bannersViewModelBuilder.Build(blockModel);
            var sectionProducts = _productViewModelBuilder.Build(blockModel);

            var mixedBlockViewModel = blockModel.MapTo <ProductsAndBannerBlockViewModel>();

            mixedBlockViewModel.Products = sectionProducts;
            mixedBlockViewModel.Banners  = sectionBanners;
            return(mixedBlockViewModel);
        }
Esempio n. 2
0
        /// <summary>
        /// Build the mixed block view model
        /// </summary>
        /// <param name="blockModel">The current mixed block</param>
        /// <returns>Return the mixed block view model</returns>
        public virtual async Task <ProductsAndBannerBlockViewModel> BuildAsync(BlockModel blockModel)
        {
            var sectionBanners  = _bannersViewModelBuilder.Build(blockModel);
            var sectionProducts = await _productViewModelBuilder.BuildAsync(blockModel);

            var mixedBlockViewModel = blockModel.MapTo <ProductsAndBannerBlockViewModel>();

            mixedBlockViewModel.Products = sectionProducts;
            mixedBlockViewModel.Products.FooterLinkText = mixedBlockViewModel.ProductLinkText;

            mixedBlockViewModel.Banners = sectionBanners;
            return(mixedBlockViewModel);
        }