Inheritance: Nop.Web.Framework.Mvc.BaseNopModel
Esempio n. 1
0
        public ActionResult GoogleProductList(GridCommand command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePromotionFeeds))
                throw new NopException("Not authorized");

            var productVariants = _productService.SearchProductVariants(command.Page - 1, command.PageSize, true);
            var productVariantsModel = productVariants
                .Select(x =>
                            {
                                var gModel = new FeedFroogleModel.GoogleProductModel()
                                {
                                    ProductVariantId = x.Id,
                                    FullProductVariantName = x.FullProductName
                                };
                                var googleProduct = _googleService.GetByProductVariantId(x.Id);
                                if (googleProduct != null)
                                    gModel.GoogleCategory = googleProduct.Taxonomy;

                                return gModel;
                            })
                .ToList();

            var model = new GridModel<FeedFroogleModel.GoogleProductModel>
            {
                Data = productVariantsModel,
                Total = productVariants.TotalCount
            };

            return new JsonResult
            {
                Data = model
            };
        }
Esempio n. 2
0
        public ActionResult GoogleProductList(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
                return Content("Access denied");

            var products = _productService.SearchProducts(pageIndex: command.Page - 1,
                pageSize: command.PageSize, showHidden: true);
            var productsModel = products
                .Select(x =>
                            {
                                var gModel = new FeedFroogleModel.GoogleProductModel
                                {
                                    ProductId = x.Id,
                                    ProductName = x.Name

                                };
                                var googleProduct = _googleService.GetByProductId(x.Id);
                                if (googleProduct != null)
                                {
                                    gModel.GoogleCategory = googleProduct.Taxonomy;
                                    gModel.Gender = googleProduct.Gender;
                                    gModel.AgeGroup = googleProduct.AgeGroup;
                                    gModel.Color = googleProduct.Color;
                                    gModel.GoogleSize = googleProduct.Size;
                                }

                                return gModel;
                            })
                .ToList();

            var gridModel = new DataSourceResult
            {
                Data = productsModel,
                Total = products.TotalCount
            };

            return Json(gridModel);
        }
        public ActionResult GoogleProductList(GridCommand command)
        {
            var productVariants = _productService.SearchProductVariants(0, 0, "", false,
                command.Page - 1, command.PageSize, true);
            var productVariantsModel = productVariants
                .Select(x =>
                            {
                                var gModel = new FeedFroogleModel.GoogleProductModel()
                                {
                                    ProductVariantId = x.Id,
                                    FullProductVariantName = x.FullProductName

                                };
                                var googleProduct = _googleService.GetByProductVariantId(x.Id);
                                if (googleProduct != null)
                                {
                                    gModel.GoogleCategory = googleProduct.Taxonomy;
                                    gModel.Gender = googleProduct.Gender;
                                    gModel.AgeGroup = googleProduct.AgeGroup;
                                    gModel.Color = googleProduct.Color;
                                    gModel.GoogleSize = googleProduct.Size;
                                }

                                return gModel;
                            })
                .ToList();

            var model = new GridModel<FeedFroogleModel.GoogleProductModel>
            {
                Data = productVariantsModel,
                Total = productVariants.TotalCount
            };

            return new JsonResult
            {
                Data = model
            };
        }