Ejemplo n.º 1
0
        public ActionResult GoogleProductUpdate(FeedFroogleModel.GoogleProductModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
            {
                return(Content("Access denied"));
            }

            var googleProduct = _googleService.GetByProductId(model.ProductId);

            if (googleProduct != null)
            {
                googleProduct.Taxonomy = model.GoogleCategory;
                googleProduct.Gender   = model.Gender;
                googleProduct.AgeGroup = model.AgeGroup;
                googleProduct.Color    = model.Color;
                googleProduct.Size     = model.GoogleSize;
                _googleService.UpdateGoogleProductRecord(googleProduct);
            }
            else
            {
                //insert
                googleProduct = new GoogleProductRecord()
                {
                    ProductId = model.ProductId,
                    Taxonomy  = model.GoogleCategory,
                    Gender    = model.Gender,
                    AgeGroup  = model.AgeGroup,
                    Color     = model.Color,
                    Size      = model.GoogleSize
                };
                _googleService.InsertGoogleProductRecord(googleProduct);
            }

            return(new NullJsonResult());
        }
        public ActionResult GoogleProductUpdate(GridCommand command, FeedFroogleModel.GoogleProductModel model)
        {
            var googleProduct = _googleService.GetByProductVariantId(model.ProductVariantId);

            if (googleProduct != null)
            {
                googleProduct.Taxonomy = model.GoogleCategory;
                googleProduct.Gender   = model.Gender;
                googleProduct.AgeGroup = model.AgeGroup;
                googleProduct.Color    = model.Color;
                googleProduct.Size     = model.GoogleSize;
                _googleService.UpdateGoogleProductRecord(googleProduct);
            }
            else
            {
                //insert
                googleProduct = new GoogleProductRecord()
                {
                    ProductVariantId = model.ProductVariantId,
                    Taxonomy         = model.GoogleCategory,
                    Gender           = model.Gender,
                    AgeGroup         = model.AgeGroup,
                    Color            = model.Color,
                    Size             = model.GoogleSize
                };
                _googleService.InsertGoogleProductRecord(googleProduct);
            }

            return(GoogleProductList(command));
        }
Ejemplo n.º 3
0
        public ActionResult GoogleProductUpdate(GridCommand command, FeedFroogleModel.GoogleProductModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePromotionFeeds))
            {
                throw new NopException("Not authorized");
            }


            var googleProduct = _googleService.GetByProductVariantId(model.ProductVariantId);

            if (googleProduct != null)
            {
                //update
                googleProduct.Taxonomy = model.GoogleCategory;
                _googleService.UpdateGoogleProductRecord(googleProduct);
            }
            else
            {
                //insert
                googleProduct = new GoogleProductRecord()
                {
                    ProductVariantId = model.ProductVariantId,
                    Taxonomy         = model.GoogleCategory
                };
                _googleService.InsertGoogleProductRecord(googleProduct);
            }

            return(GoogleProductList(command));
        }
Ejemplo n.º 4
0
        public IActionResult Edit(GoogleProductModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
            {
                return(AccessDeniedView());
            }

            var googleProduct = _googleService.GetByProductId(model.ProductId);

            if (googleProduct != null)
            {
                googleProduct.Taxonomy    = model.GoogleCategory;
                googleProduct.Gender      = model.Gender;
                googleProduct.AgeGroup    = model.AgeGroup;
                googleProduct.Color       = model.Color;
                googleProduct.Size        = model.GoogleSize;
                googleProduct.CustomGoods = model.CustomGoods;
                _googleService.UpdateGoogleProductRecord(googleProduct);
            }
            else
            {
                //insert
                googleProduct = new GoogleProductRecord
                {
                    ProductId   = model.ProductId,
                    Taxonomy    = model.GoogleCategory,
                    Gender      = model.Gender,
                    AgeGroup    = model.AgeGroup,
                    Color       = model.Color,
                    Size        = model.GoogleSize,
                    CustomGoods = model.CustomGoods
                };
                _googleService.InsertGoogleProductRecord(googleProduct);
            }

            ViewBag.RefreshPage = true;

            return(View("~/Plugins/Feed.GoogleShopping/Views/Edit.cshtml", model));
        }
        public ActionResult GoogleProductUpdate(GridCommand command, FeedFroogleModel.GoogleProductModel model)
        {
            var googleProduct = _googleService.GetByProductVariantId(model.ProductVariantId);

            if (googleProduct != null)
            {
                //update
                googleProduct.Taxonomy = model.GoogleCategory;
                _googleService.UpdateGoogleProductRecord(googleProduct);
            }
            else
            {
                //insert
                googleProduct = new GoogleProductRecord()
                {
                    ProductVariantId = model.ProductVariantId,
                    Taxonomy         = model.GoogleCategory
                };
                _googleService.InsertGoogleProductRecord(googleProduct);
            }

            return(GoogleProductList(command));
        }
        public async Task <IActionResult> GoogleProductUpdate(FeedGoogleShoppingModel.GoogleProductModel model)
        {
            if (!await _permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
            {
                return(Content("Access denied"));
            }

            var googleProduct = await _googleService.GetByProductId(model.ProductId);

            if (googleProduct != null)
            {
                googleProduct.Taxonomy    = model.GoogleCategory;
                googleProduct.Gender      = model.Gender;
                googleProduct.AgeGroup    = model.AgeGroup;
                googleProduct.Color       = model.Color;
                googleProduct.Size        = model.GoogleSize;
                googleProduct.CustomGoods = model.CustomGoods;
                await _googleService.UpdateGoogleProductRecord(googleProduct);
            }
            else
            {
                //insert
                googleProduct = new GoogleProductRecord
                {
                    ProductId   = model.ProductId,
                    Taxonomy    = model.GoogleCategory,
                    Gender      = model.Gender,
                    AgeGroup    = model.AgeGroup,
                    Color       = model.Color,
                    Size        = model.GoogleSize,
                    CustomGoods = model.CustomGoods
                };
                await _googleService.InsertGoogleProductRecord(googleProduct);
            }

            return(new NullJsonResult());
        }