Esempio n. 1
0
        public ActionResult DeleteRateByCountryStateZip(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(Content("Access denied"));
            }

            var taxRate = _taxRateService.GetTaxRateById(id);

            if (taxRate != null)
            {
                _taxRateService.DeleteTaxRate(taxRate);
            }

            return(new NullJsonResult());
        }
        //tax category
        public void HandleEvent(EntityDeleted <TaxCategory> eventMessage)
        {
            if (eventMessage.Entity == null)
            {
                return;
            }

            //delete an appropriate record when tax category is deleted
            var recordsToDelete = _taxRateService.GetAllTaxRates().Where(tr => tr.TaxCategoryId == eventMessage.Entity.Id).ToList();

            foreach (var taxRate in recordsToDelete)
            {
                _taxRateService.DeleteTaxRate(taxRate);
            }

            var settingKey = string.Format("Tax.TaxProvider.FixedOrByCountryStateZip.TaxCategoryId{0}", eventMessage.Entity.Id);
            var setting    = _settingService.GetSetting(settingKey);

            if (setting != null)
            {
                _settingService.DeleteSetting(setting);
            }
        }