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 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; } return(gModel); }) .ToList(); var model = new GridModel <FeedFroogleModel.GoogleProductModel> { Data = productVariantsModel, Total = productVariants.TotalCount }; return(new JsonResult { Data = model }); }
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)); }
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)); }
public ActionResult GoogleProductList(GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins)) { return(Content("Access denied")); } var productVariants = _productService.SearchProductVariants(0, 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 }); }
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; gModel.CustomGoods = googleProduct.CustomGoods; } return(gModel); }) .ToList(); var gridModel = new DataSourceResult { Data = productsModel, Total = products.TotalCount }; return(Json(gridModel)); }
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 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 }); }