コード例 #1
0
        public override IActionResult CategoryDelete(int id)
        {
            //ensure that Avalara tax provider is active
            if (!(_taxService.LoadActiveTaxProvider(_workContext.CurrentCustomer) is AvalaraTaxProvider))
            {
                return(new NullJsonResult());
            }

            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedView());
            }

            var taxCategory = _taxCategoryService.GetTaxCategoryById(id);

            if (taxCategory == null)
            {
                throw new ArgumentException("No tax category found with the specified id");
            }

            //delete generic attributes
            _genericAttributeService.SaveAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeDescriptionAttribute, null);
            _genericAttributeService.SaveAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeTypeAttribute, null);

            _taxCategoryService.DeleteTaxCategory(taxCategory);

            return(new NullJsonResult());
        }
コード例 #2
0
        public ActionResult CategoryDelete(int id, GridCommand command)
        {
            var taxCategory = _taxCategoryService.GetTaxCategoryById(id);

            _taxCategoryService.DeleteTaxCategory(taxCategory);

            return(Categories(command));
        }
コード例 #3
0
ファイル: TaxController.cs プロジェクト: huyhuana/grandnode-1
        public async Task<IActionResult> CategoryDelete(string id)
        {
            var taxCategory = await _taxCategoryService.GetTaxCategoryById(id);
            if (taxCategory == null)
                throw new ArgumentException("No tax category found with the specified id");
            await _taxCategoryService.DeleteTaxCategory(taxCategory);

            return new NullJsonResult();
        }
コード例 #4
0
        public ActionResult CategoryDelete(int id, GridCommand command)
        {
            if (_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                var taxCategory = _taxCategoryService.GetTaxCategoryById(id);

                _taxCategoryService.DeleteTaxCategory(taxCategory);
            }

            return(Categories(command));
        }
コード例 #5
0
        public IActionResult CategoryDelete(string id)
        {
            var taxCategory = _taxCategoryService.GetTaxCategoryById(id);

            if (taxCategory == null)
            {
                throw new ArgumentException("No tax category found with the specified id");
            }
            _taxCategoryService.DeleteTaxCategory(taxCategory);

            return(new NullJsonResult());
        }
コード例 #6
0
        public virtual IActionResult CategoryDelete(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedView());
            }

            //try to get a tax category with the specified id
            var taxCategory = _taxCategoryService.GetTaxCategoryById(id)
                              ?? throw new ArgumentException("No tax category found with the specified id", nameof(id));

            _taxCategoryService.DeleteTaxCategory(taxCategory);

            return(new NullJsonResult());
        }
コード例 #7
0
        public ActionResult CategoryDelete(int id, GridCommand command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedView());
            }

            var taxCategory = _taxCategoryService.GetTaxCategoryById(id);

            if (taxCategory == null)
            {
                throw new ArgumentException("No tax category found with the specified id");
            }
            _taxCategoryService.DeleteTaxCategory(taxCategory);

            return(Categories(command));
        }
コード例 #8
0
 /// <summary>
 /// Deletes a tax category
 /// </summary>
 /// <param name="taxCategory">Tax category</param>
 public void DeleteTaxCategory([FromBody] TaxCategory taxCategory)
 {
     _taxCategoryService.DeleteTaxCategory(taxCategory);
 }