public virtual async Task <IActionResult> Index() { //display a warning to a store owner if there are some error var hideCard = await _genericAttributeService.GetAttributeAsync <bool>(await _workContext.GetCurrentCustomerAsync(), NopCustomerDefaults.HideConfigurationStepsAttribute); var closeCard = await _genericAttributeService.GetAttributeAsync <bool>(await _workContext.GetCurrentCustomerAsync(), NopCustomerDefaults.CloseConfigurationStepsAttribute); if ((hideCard || closeCard) && await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageMaintenance)) { var warnings = await _commonModelFactory.PrepareSystemWarningModelsAsync(); if (warnings.Any(warning => warning.Level == SystemWarningLevel.Fail || warning.Level == SystemWarningLevel.CopyrightRemovalKey || warning.Level == SystemWarningLevel.Warning)) { _notificationService.WarningNotification( string.Format(await _localizationService.GetResourceAsync("Admin.System.Warnings.Errors"), Url.Action("Warnings", "Common")), //do not encode URLs false); } } //prepare model var model = await _homeModelFactory.PrepareDashboardModelAsync(new DashboardModel()); return(View(model)); }
public virtual async Task <IActionResult> Index() { //display a warning to a store owner if there are some error var customer = await _workContext.GetCurrentCustomerAsync(); var hideCard = await _genericAttributeService.GetAttributeAsync <bool>(customer, NopCustomerDefaults.HideConfigurationStepsAttribute); var closeCard = await _genericAttributeService.GetAttributeAsync <bool>(customer, NopCustomerDefaults.CloseConfigurationStepsAttribute); if ((hideCard || closeCard) && await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageMaintenance)) { var warnings = await _commonModelFactory.PrepareSystemWarningModelsAsync(); if (warnings.Any(warning => warning.Level == SystemWarningLevel.Fail || warning.Level == SystemWarningLevel.CopyrightRemovalKey || warning.Level == SystemWarningLevel.Warning)) { _notificationService.WarningNotification( string.Format(await _localizationService.GetResourceAsync("Admin.System.Warnings.Errors"), Url.Action("Warnings", "Common")), //do not encode URLs false); } } //progress of localozation var currentLanguage = await _workContext.GetWorkingLanguageAsync(); var progress = await _genericAttributeService.GetAttributeAsync <string>(currentLanguage, NopCommonDefaults.LanguagePackProgressAttribute); if (!string.IsNullOrEmpty(progress)) { var locale = await _localizationService.GetResourceAsync("Admin.Configuration.LanguagePackProgressMessage"); _notificationService.SuccessNotification(string.Format(locale, progress, NopLinksDefaults.OfficialSite.Translations), false); await _genericAttributeService.SaveAttributeAsync(currentLanguage, NopCommonDefaults.LanguagePackProgressAttribute, string.Empty); } //prepare model var model = await _homeModelFactory.PrepareDashboardModelAsync(new DashboardModel()); return(View(model)); }