Пример #1
0
        public IActionResult ImportTaxCodes()
        {
            //ensure that Avalara tax provider is active
            if (!_taxPluginManager.IsPluginActive(AvalaraTaxDefaults.SystemName))
            {
                return(Categories());
            }

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

            //import tax caodes
            var importedTaxCodesNumber = _avalaraTaxManager.ImportTaxCodes();

            if (importedTaxCodesNumber.HasValue)
            {
                //successfully imported
                var successMessage = _localizationService.GetResource("Plugins.Tax.Avalara.TaxCodes.Import.Success");
                _notificationService.SuccessNotification(string.Format(successMessage, importedTaxCodesNumber));
            }
            else
            {
                _notificationService.ErrorNotification(_localizationService.GetResource("Plugins.Tax.Avalara.TaxCodes.Import.Error"));
            }

            return(Categories());
        }