Esempio n. 1
0
        public ActionResult RelatedProducts(int productId, int?productThumbPictureSize)
        {
            var products        = new List <Product>();
            var relatedProducts = _productService.GetRelatedProductsByProductId1(productId);

            foreach (var product in _productService.GetProductsByIds(relatedProducts.Select(x => x.ProductId2).ToArray()))
            {
                //ensure has ACL permission and appropriate store mapping
                if (_aclService.Authorize(product) && _storeMappingService.Authorize(product))
                {
                    products.Add(product);
                }
            }

            if (products.Count == 0)
            {
                return(Content(""));
            }

            var model = _helper.PrepareProductOverviewModels(products, true, true, productThumbPictureSize).ToList();

            return(PartialView(model));
        }