public IActionResult ProductAddPopup(string btnId, CustomerTagProductModel.AddProductModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts))
                return AccessDeniedView();

            if (model.SelectedProductIds != null)
            {
                foreach (string id in model.SelectedProductIds)
                {
                    var product = _productService.GetProductById(id);
                    if (product != null)
                    {
                        var customerTagProduct = _customerTagService.GetCustomerTagProduct(model.CustomerTagId, id);
                        if (customerTagProduct == null)
                        {
                            customerTagProduct = new CustomerTagProduct();
                            customerTagProduct.CustomerTagId = model.CustomerTagId;
                            customerTagProduct.ProductId = id;
                            customerTagProduct.DisplayOrder = 0;
                            _customerTagService.InsertCustomerTagProduct(customerTagProduct);
                        }
                    }
                }
            }

            //a vendor should have access only to his products
            ViewBag.RefreshPage = true;
            ViewBag.btnId = btnId;
            return View(model);
        }
 public virtual void InsertProductModel(CustomerTagProductModel.AddProductModel model)
 {
     foreach (string id in model.SelectedProductIds)
     {
         var product = _productService.GetProductById(id);
         if (product != null)
         {
             var customerTagProduct = _customerTagService.GetCustomerTagProduct(model.CustomerTagId, id);
             if (customerTagProduct == null)
             {
                 customerTagProduct = new CustomerTagProduct();
                 customerTagProduct.CustomerTagId = model.CustomerTagId;
                 customerTagProduct.ProductId     = id;
                 customerTagProduct.DisplayOrder  = 0;
                 _customerTagService.InsertCustomerTagProduct(customerTagProduct);
             }
         }
     }
 }