Ejemplo n.º 1
0
        public IActionResult ExportTaxCodes()
        {
            //ensure that Avalara tax provider is active
            if (!_taxPluginManager.IsPluginActive(AvalaraTaxDefaults.SystemName))
            {
                return(Categories());
            }

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

            //export tax codes
            var exportedTaxCodes = _avalaraTaxManager.ExportTaxCodes();

            if (exportedTaxCodes.HasValue)
            {
                if (exportedTaxCodes > 0)
                {
                    _notificationService.SuccessNotification(string.Format(_localizationService.GetResource("Plugins.Tax.Avalara.TaxCodes.Export.Success"), exportedTaxCodes));
                }
                else
                {
                    _notificationService.SuccessNotification(_localizationService.GetResource("Plugins.Tax.Avalara.TaxCodes.Export.AlreadyExported"));
                }
            }
            else
            {
                _notificationService.ErrorNotification(_localizationService.GetResource("Plugins.Tax.Avalara.TaxCodes.Export.Error"));
            }

            return(Categories());
        }