Example #1
0
        public async Task <IViewComponentResult> InvokeAsync(string blogPostId, int?productThumbPictureSize)
        {
            var products = await _blogService.GetProductsByBlogPostId(blogPostId);

            if (!products.Any())
            {
                return(Content(""));
            }

            var model = await _productViewModelService.PrepareIdsProducts(products.Select(x => x.ProductId).ToArray(), productThumbPictureSize);

            if (!model.Any())
            {
                return(Content(""));
            }

            return(View(model));
        }