Esempio n. 1
0
        public IViewComponentResult Invoke(string makeCode, string colorName, int productId = 0, bool isSleepSizes = false)
        {
            if (string.IsNullOrEmpty(makeCode))
            {
                return(Content(""));
            }
            IEnumerable <Product> products = _productService.SearchProducts(
                storeId: _storeContext.CurrentStore.Id,
                orderBy: ProductSortingEnum.CreatedOn);

            var product = products.FirstOrDefault(x => x.Id == productId);

            if (product == null)
            {
                return(Content(""));
            }

            ViewBag.ProductName = product.Name;

            //prepare model
            var model = _specificationAttributeService.GetSimilarProductSizes(makeCode, colorName, product, isSleepSizes);

            return(View(model));
        }