Exemplo n.º 1
0
        public ActionResult ProductDetailsModule(Module_ProductDetails module)
        {
            var product = AgilityContext.GetDynamicPageItem <Product>();

            var model = new ProductDetailsModule();

            model.Module = module;

            if (product != null && product.ReferenceName == "Products")
            {
                model.Product = product;

                var category = new AgilityContentRepository <ProductCategory>("ProductCategories").Items().Where(i => i.ContentID == product.ProductCategoryID).FirstOrDefault();
                model.Category = category;
            }

            return(PartialView(model));
        }
        public Task <IViewComponentResult> InvokeAsync(Module_ProductDetails module)
        {
            return(Task.Run <IViewComponentResult>(() =>
            {
                var product = AgilityContext.GetDynamicPageItem <Product>();

                var model = new ProductDetailsModule();
                model.Module = module;

                if (product != null && product.ReferenceName == "Products")
                {
                    model.Product = product;

                    var category = new AgilityContentRepository <ProductCategory>("ProductCategories").Items().Where(i => i.ContentID == product.ProductCategoryID).FirstOrDefault();
                    model.Category = category;
                }



                return View("~/Views/Products/ProductDetailsModule.cshtml", model);
            }));
        }