diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs index 6912c0f877e..a80cf12e96f 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs @@ -87,7 +87,7 @@ public async Task List(ContentOptions options, PagerParameters pa catch (Exception ex) { _logger.LogError(ex, "Error when retrieving the list of admin menus."); - _notifier.Error(H["Error when retrieving the list of admin menus."]); + await _notifier.ErrorAsync(H["Error when retrieving the list of admin menus."]); } // Maintain previous route data when generating page links @@ -197,7 +197,7 @@ public async Task Edit(AdminMenuEditViewModel model) await _adminMenuService.SaveAsync(adminMenu); - _notifier.Success(H["Admin menu updated successfully."]); + await _notifier.SuccessAsync(H["Admin menu updated successfully."]); return RedirectToAction(nameof(List)); } @@ -218,7 +218,7 @@ public async Task Delete(string id) if (adminMenu == null) { - _notifier.Error(H["Can't find the admin menu."]); + await _notifier.ErrorAsync(H["Can't find the admin menu."]); return RedirectToAction(nameof(List)); } @@ -226,11 +226,11 @@ public async Task Delete(string id) if (removed == 1) { - _notifier.Success(H["Admin menu deleted successfully."]); + await _notifier.SuccessAsync(H["Admin menu deleted successfully."]); } else { - _notifier.Error(H["Can't delete the admin menu."]); + await _notifier.ErrorAsync(H["Can't delete the admin menu."]); } return RedirectToAction(nameof(List)); @@ -259,7 +259,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn var adminMenu = adminMenuList.FirstOrDefault(x => String.Equals(x.Id, item.Id, StringComparison.OrdinalIgnoreCase)); await _adminMenuService.DeleteAsync(adminMenu); } - _notifier.Success(H["Admin menus successfully removed."]); + await _notifier.SuccessAsync(H["Admin menus successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); @@ -289,7 +289,7 @@ public async Task Toggle(string id) await _adminMenuService.SaveAsync(adminMenu); - _notifier.Success(H["Admin menu toggled successfully."]); + await _notifier.SuccessAsync(H["Admin menu toggled successfully."]); return RedirectToAction(nameof(List)); } diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs index 54fbca088f5..849a4023581 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs @@ -149,7 +149,7 @@ public async Task Create(AdminNodeEditViewModel model) adminMenu.MenuItems.Add(treeNode); await _adminMenuService.SaveAsync(adminMenu); - _notifier.Success(H["Admin node added successfully."]); + await _notifier.SuccessAsync(H["Admin node added successfully."]); return RedirectToAction(nameof(List), new { id = model.AdminMenuId }); } @@ -229,11 +229,11 @@ public async Task Edit(AdminNodeEditViewModel model) await _adminMenuService.SaveAsync(adminMenu); - _notifier.Success(H["Admin node updated successfully."]); + await _notifier.SuccessAsync(H["Admin node updated successfully."]); return RedirectToAction(nameof(List), new { id = model.AdminMenuId }); } - _notifier.Error(H["The admin node has validation errors."]); + await _notifier.ErrorAsync(H["The admin node has validation errors."]); model.Editor = editor; // If we got this far, something failed, redisplay form @@ -270,7 +270,7 @@ public async Task Delete(string id, string treeNodeId) await _adminMenuService.SaveAsync(adminMenu); - _notifier.Success(H["Admin node deleted successfully."]); + await _notifier.SuccessAsync(H["Admin node deleted successfully."]); return RedirectToAction(nameof(List), new { id }); } @@ -302,7 +302,7 @@ public async Task Toggle(string id, string treeNodeId) await _adminMenuService.SaveAsync(adminMenu); - _notifier.Success(H["Admin node toggled successfully."]); + await _notifier.SuccessAsync(H["Admin node toggled successfully."]); return RedirectToAction(nameof(List), new { id = id }); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs index f09cca99623..b718f7d861a 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs @@ -72,19 +72,19 @@ public async Task Localize(string contentItemId, string targetCul if (alreadyLocalizedContent != null) { - _notifier.Warning(H["A localization already exists for '{0}'.", targetCulture]); + await _notifier.WarningAsync(H["A localization already exists for '{0}'.", targetCulture]); return RedirectToAction("Edit", "Admin", new { area = "OrchardCore.Contents", contentItemId = contentItemId }); } try { var newContent = await _contentLocalizationManager.LocalizeAsync(contentItem, targetCulture); - _notifier.Information(H["Localized version of the content created successfully."]); + await _notifier.InformationAsync(H["Localized version of the content created successfully."]); return RedirectToAction("Edit", "Admin", new { area = "OrchardCore.Contents", contentItemId = newContent.ContentItemId }); } catch (InvalidOperationException) { - _notifier.Warning(H["Could not create localized version of the content item."]); + await _notifier.WarningAsync(H["Could not create localized version of the content item."]); return RedirectToAction("Edit", "Admin", new { area = "OrchardCore.Contents", contentItemId = contentItem.ContentItemId }); } } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs index ebd94b54420..876527b06b6 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs @@ -141,7 +141,7 @@ public async Task CreatePOST(CreateTypeViewModel viewModel) var typeViewModel = new EditTypeViewModel(contentTypeDefinition); - _notifier.Success(H["The \"{0}\" content type has been created.", typeViewModel.DisplayName]); + await _notifier.SuccessAsync(H["The \"{0}\" content type has been created.", typeViewModel.DisplayName]); return RedirectToAction("AddPartsTo", new { id = typeViewModel.Name }); } @@ -200,7 +200,7 @@ public async Task EditPOST(string id, EditTypeViewModel viewModel) _contentDefinitionService.AlterPartFieldsOrder(ownedPartDefinition, viewModel.OrderedFieldNames); } _contentDefinitionService.AlterTypePartsOrder(contentTypeDefinition, viewModel.OrderedPartNames); - _notifier.Success(H["\"{0}\" settings have been saved.", contentTypeDefinition.Name]); + await _notifier.SuccessAsync(H["\"{0}\" settings have been saved.", contentTypeDefinition.Name]); } return RedirectToAction(nameof(Edit), new { id }); @@ -224,7 +224,7 @@ public async Task Delete(string id) _contentDefinitionService.RemoveType(id, true); - _notifier.Success(H["\"{0}\" has been removed.", typeViewModel.DisplayName]); + await _notifier.SuccessAsync(H["\"{0}\" has been removed.", typeViewModel.DisplayName]); return RedirectToAction(nameof(List)); } @@ -313,7 +313,7 @@ public async Task AddPartsToPOST(string id) foreach (var partToAdd in partsToAdd) { _contentDefinitionService.AddPartToType(partToAdd, typeViewModel.Name); - _notifier.Success(H["The \"{0}\" part has been added.", partToAdd]); + await _notifier.SuccessAsync(H["The \"{0}\" part has been added.", partToAdd]); } if (!ModelState.IsValid) @@ -394,7 +394,7 @@ public async Task AddReusablePartToPOST(string id) _contentDefinitionService.AddReusablePartToType(viewModel.Name, viewModel.DisplayName, viewModel.Description, partToAdd, typeViewModel.Name); - _notifier.Success(H["The \"{0}\" part has been added.", partToAdd]); + await _notifier.SuccessAsync(H["The \"{0}\" part has been added.", partToAdd]); return RedirectToAction(nameof(Edit), new { id }); } @@ -416,7 +416,7 @@ public async Task RemovePart(string id, string name) _contentDefinitionService.RemovePartFromType(name, id); - _notifier.Success(H["The \"{0}\" part has been removed.", name]); + await _notifier.SuccessAsync(H["The \"{0}\" part has been removed.", name]); return RedirectToAction(nameof(Edit), new { id }); } @@ -493,11 +493,11 @@ public async Task CreatePartPOST(CreatePartViewModel viewModel) if (partViewModel == null) { - _notifier.Information(H["The content part could not be created."]); + await _notifier.InformationAsync(H["The content part could not be created."]); return View(viewModel); } - _notifier.Success(H["The \"{0}\" content part has been created.", partViewModel.Name]); + await _notifier.SuccessAsync(H["The \"{0}\" content part has been created.", partViewModel.Name]); return RedirectToAction(nameof(EditPart), new { id = partViewModel.Name }); } @@ -549,7 +549,7 @@ public async Task EditPartPOST(string id, string[] orderedFieldNam else { _contentDefinitionService.AlterPartFieldsOrder(contentPartDefinition, orderedFieldNames); - _notifier.Success(H["The settings of \"{0}\" have been saved.", contentPartDefinition.Name]); + await _notifier.SuccessAsync(H["The settings of \"{0}\" have been saved.", contentPartDefinition.Name]); } return RedirectToAction(nameof(EditPart), new { id }); @@ -573,7 +573,7 @@ public async Task DeletePart(string id) _contentDefinitionService.RemovePart(id); - _notifier.Information(H["\"{0}\" has been removed.", partViewModel.DisplayName]); + await _notifier.InformationAsync(H["\"{0}\" has been removed.", partViewModel.DisplayName]); return RedirectToAction(nameof(ListParts)); } @@ -665,7 +665,7 @@ public async Task AddFieldToPOST(AddFieldViewModel viewModel, stri _contentDefinitionService.AddFieldToPart(viewModel.Name, viewModel.DisplayName, viewModel.FieldTypeName, partDefinition.Name); - _notifier.Success(H["The field \"{0}\" has been added.", viewModel.DisplayName]); + await _notifier.SuccessAsync(H["The field \"{0}\" has been added.", viewModel.DisplayName]); if (!String.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) { @@ -767,7 +767,7 @@ public async Task EditFieldPOST(string id, EditFieldViewModel view return View(viewModel); } - _notifier.Information(H["Display name changed to {0}.", viewModel.DisplayName]); + await _notifier.InformationAsync(H["Display name changed to {0}.", viewModel.DisplayName]); } _contentDefinitionService.AlterField(partViewModel, viewModel); @@ -786,7 +786,7 @@ public async Task EditFieldPOST(string id, EditFieldViewModel view } else { - _notifier.Success(H["The \"{0}\" field settings have been saved.", field.DisplayName()]); + await _notifier.SuccessAsync(H["The \"{0}\" field settings have been saved.", field.DisplayName()]); } if (!String.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) @@ -830,7 +830,7 @@ public async Task RemoveFieldFromPOST(string id, string name) _contentDefinitionService.RemoveFieldFromPart(name, partViewModel.Name); - _notifier.Success(H["The \"{0}\" field has been removed.", field.DisplayName()]); + await _notifier.SuccessAsync(H["The \"{0}\" field has been removed.", field.DisplayName()]); if (_contentDefinitionService.LoadType(id) != null) { @@ -949,7 +949,7 @@ public async Task EditTypePartPOST(string id, EditTypePartViewMode } else { - _notifier.Success(H["The \"{0}\" part settings have been saved.", part.DisplayName()]); + await _notifier.SuccessAsync(H["The \"{0}\" part settings have been saved.", part.DisplayName()]); } return RedirectToAction(nameof(Edit), new { id }); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Controllers/AuditTrailContentController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Controllers/AuditTrailContentController.cs index ac85cff22d8..582f47b8ec1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Controllers/AuditTrailContentController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Controllers/AuditTrailContentController.cs @@ -113,16 +113,16 @@ public async Task Restore(string auditTrailEventId) var result = await _contentManager.RestoreAsync(contentItem); if (!result.Succeeded) { - _notifier.Warning(H["'{0}' was not restored, the version is not valid.", contentItem.DisplayText]); + await _notifier.WarningAsync(H["'{0}' was not restored, the version is not valid.", contentItem.DisplayText]); foreach (var error in result.Errors) { - _notifier.Warning(new LocalizedHtmlString(error.ErrorMessage, error.ErrorMessage)); + await _notifier.WarningAsync(new LocalizedHtmlString(error.ErrorMessage, error.ErrorMessage)); } return RedirectToAction("Index", "Admin", new { area = "OrchardCore.AuditTrail" }); } - _notifier.Success(H["'{0}' has been restored.", contentItem.DisplayText]); + await _notifier.SuccessAsync(H["'{0}' has been restored.", contentItem.DisplayText]); return RedirectToAction("Index", "Admin", new { area = "OrchardCore.AuditTrail" }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs index 585a03c392b..3c035d6e505 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs @@ -88,9 +88,9 @@ public AdminController( [HttpGet] public async Task List( - [ModelBinder(BinderType = typeof(ContentItemFilterEngineModelBinder), Name = "q")] QueryFilterResult queryFilterResult, + [ModelBinder(BinderType = typeof(ContentItemFilterEngineModelBinder), Name = "q")] QueryFilterResult queryFilterResult, ContentOptionsViewModel options, - PagerParameters pagerParameters, + PagerParameters pagerParameters, string contentTypeId = "") { var context = _httpContextAccessor.HttpContext; @@ -320,42 +320,42 @@ public async Task ListPOST(ContentOptionsViewModel options, IEnume { if (!await _authorizationService.AuthorizeAsync(User, CommonPermissions.PublishContent, item)) { - _notifier.Warning(H["Couldn't publish selected content."]); + await _notifier.WarningAsync(H["Couldn't publish selected content."]); await _session.CancelAsync(); return Forbid(); } await _contentManager.PublishAsync(item); } - _notifier.Success(H["Content published successfully."]); + await _notifier.SuccessAsync(H["Content published successfully."]); break; case ContentsBulkAction.Unpublish: foreach (var item in checkedContentItems) { if (!await _authorizationService.AuthorizeAsync(User, CommonPermissions.PublishContent, item)) { - _notifier.Warning(H["Couldn't unpublish selected content."]); + await _notifier.WarningAsync(H["Couldn't unpublish selected content."]); await _session.CancelAsync(); return Forbid(); } await _contentManager.UnpublishAsync(item); } - _notifier.Success(H["Content unpublished successfully."]); + await _notifier.SuccessAsync(H["Content unpublished successfully."]); break; case ContentsBulkAction.Remove: foreach (var item in checkedContentItems) { if (!await _authorizationService.AuthorizeAsync(User, CommonPermissions.DeleteContent, item)) { - _notifier.Warning(H["Couldn't remove selected content."]); + await _notifier.WarningAsync(H["Couldn't remove selected content."]); await _session.CancelAsync(); return Forbid(); } await _contentManager.RemoveAsync(item); } - _notifier.Success(H["Content removed successfully."]); + await _notifier.SuccessAsync(H["Content removed successfully."]); break; default: throw new ArgumentOutOfRangeException(); @@ -398,7 +398,7 @@ public Task CreatePOST(string id, [Bind(Prefix = "submit.Save")] var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - _notifier.Success(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) ? H["Your content draft has been saved."] : H["Your {0} draft has been saved.", typeDefinition.DisplayName]); }); @@ -426,7 +426,7 @@ public async Task CreateAndPublishPOST(string id, [Bind(Prefix = var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - _notifier.Success(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) ? H["Your content has been published."] : H["Your {0} has been published.", typeDefinition.DisplayName]); }); @@ -523,7 +523,7 @@ public Task EditPOST(string contentItemId, [Bind(Prefix = "submit var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - _notifier.Success(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) ? H["Your content draft has been saved."] : H["Your {0} draft has been saved.", typeDefinition.DisplayName]); }); @@ -552,7 +552,7 @@ public async Task EditAndPublishPOST(string contentItemId, [Bind( var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - _notifier.Success(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) ? H["Your content has been published."] : H["Your {0} has been published.", typeDefinition.DisplayName]); }); @@ -617,11 +617,11 @@ public async Task Clone(string contentItemId, string returnUrl) } catch (InvalidOperationException) { - _notifier.Warning(H["Could not clone the content item."]); + await _notifier.WarningAsync(H["Could not clone the content item."]); return Url.IsLocalUrl(returnUrl) ? (IActionResult)LocalRedirect(returnUrl) : RedirectToAction(nameof(List)); } - _notifier.Information(H["Successfully cloned. The clone was saved as a draft."]); + await _notifier.InformationAsync(H["Successfully cloned. The clone was saved as a draft."]); return Url.IsLocalUrl(returnUrl) ? (IActionResult)LocalRedirect(returnUrl) : RedirectToAction(nameof(List)); } @@ -647,7 +647,7 @@ public async Task DiscardDraft(string contentItemId, string retur await _contentManager.DiscardDraftAsync(contentItem); - _notifier.Success(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) ? H["The draft has been removed."] : H["The {0} draft has been removed.", typeDefinition.DisplayName]); } @@ -671,7 +671,7 @@ public async Task Remove(string contentItemId, string returnUrl) await _contentManager.RemoveAsync(contentItem); - _notifier.Success(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) ? H["That content has been removed."] : H["That {0} has been removed.", typeDefinition.DisplayName]); } @@ -699,11 +699,11 @@ public async Task Publish(string contentItemId, string returnUrl) if (string.IsNullOrEmpty(typeDefinition.DisplayName)) { - _notifier.Success(H["That content has been published."]); + await _notifier.SuccessAsync(H["That content has been published."]); } else { - _notifier.Success(H["That {0} has been published.", typeDefinition.DisplayName]); + await _notifier.SuccessAsync(H["That {0} has been published.", typeDefinition.DisplayName]); } return Url.IsLocalUrl(returnUrl) ? (IActionResult)LocalRedirect(returnUrl) : RedirectToAction(nameof(List)); @@ -729,11 +729,11 @@ public async Task Unpublish(string contentItemId, string returnUr if (string.IsNullOrEmpty(typeDefinition.DisplayName)) { - _notifier.Success(H["The content has been unpublished."]); + await _notifier.SuccessAsync(H["The content has been unpublished."]); } else { - _notifier.Success(H["The {0} has been unpublished.", typeDefinition.DisplayName]); + await _notifier.SuccessAsync(H["The {0} has been unpublished.", typeDefinition.DisplayName]); } return Url.IsLocalUrl(returnUrl) ? (IActionResult)LocalRedirect(returnUrl) : RedirectToAction(nameof(List)); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanController.cs index 89b4504f451..31f487d3fee 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanController.cs @@ -79,7 +79,7 @@ await _authorizationService.AuthorizeAsync(User, OrchardCore.Deployment.CommonPe deploymentPlan.DeploymentSteps.Add(step); - _notifier.Success(H["Content added successfully to the deployment plan."]); + await _notifier.SuccessAsync(H["Content added successfully to the deployment plan."]); _session.Save(deploymentPlan); @@ -116,7 +116,7 @@ await _authorizationService.AuthorizeAsync(User, OrchardCore.Deployment.CommonPe // Requesting EditContent would allow custom permissions to deny access to this content item. if (!await _authorizationService.AuthorizeAsync(User, CommonPermissions.EditContent, item)) { - _notifier.Warning(H["Couldn't add selected content to deployment plan."]); + await _notifier.WarningAsync(H["Couldn't add selected content to deployment plan."]); return Forbid(); } @@ -126,7 +126,7 @@ await _authorizationService.AuthorizeAsync(User, OrchardCore.Deployment.CommonPe deploymentPlan.DeploymentSteps.Add(step); } - _notifier.Success(H["Content added successfully to the deployment plan."]); + await _notifier.SuccessAsync(H["Content added successfully to the deployment plan."]); _session.Save(deploymentPlan); diff --git a/src/OrchardCore.Modules/OrchardCore.Cors/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Cors/Controllers/AdminController.cs index b5ef1774477..48294af391b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Cors/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Cors/Controllers/AdminController.cs @@ -119,7 +119,7 @@ public async Task IndexPOST() await _corsService.UpdateSettingsAsync(corsSettings); - _notifier.Success(TH["The CORS settings have updated successfully."]); + await _notifier.SuccessAsync(TH["The CORS settings have updated successfully."]); return View(model); } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs index da826ac68dd..79fc09dba43 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs @@ -104,11 +104,11 @@ public async Task Execute(int id, string remoteInstanceId, string if (response.StatusCode == System.Net.HttpStatusCode.OK) { - _notifier.Success(H["Deployment executed successfully."]); + await _notifier.SuccessAsync(H["Deployment executed successfully."]); } else { - _notifier.Error(H["An error occurred while sending the deployment to the remote instance: \"{0} ({1})\"", response.ReasonPhrase, (int)response.StatusCode]); + await _notifier.ErrorAsync(H["An error occurred while sending the deployment to the remote instance: \"{0} ({1})\"", response.ReasonPhrase, (int)response.StatusCode]); } } finally diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs index 151f6a8bfc0..5c5436666ef 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs @@ -134,7 +134,7 @@ public async Task Create(EditRemoteClientViewModel model) { await _remoteClientService.CreateRemoteClientAsync(model.ClientName, model.ApiKey); - _notifier.Success(H["Remote client created successfully."]); + await _notifier.SuccessAsync(H["Remote client created successfully."]); return RedirectToAction(nameof(Index)); } @@ -190,7 +190,7 @@ public async Task Edit(EditRemoteClientViewModel model) { await _remoteClientService.TryUpdateRemoteClient(model.Id, model.ClientName, model.ApiKey); - _notifier.Success(H["Remote client updated successfully."]); + await _notifier.SuccessAsync(H["Remote client updated successfully."]); return RedirectToAction(nameof(Index)); } @@ -216,7 +216,7 @@ public async Task Delete(string id) await _remoteClientService.DeleteRemoteClientAsync(id); - _notifier.Success(H["Remote client deleted successfully."]); + await _notifier.SuccessAsync(H["Remote client deleted successfully."]); return RedirectToAction(nameof(Index)); } @@ -244,7 +244,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn { await _remoteClientService.DeleteRemoteClientAsync(item.Id); } - _notifier.Success(H["Remote clients successfully removed."]); + await _notifier.SuccessAsync(H["Remote clients successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs index 3fd059815de..a04907decbc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs @@ -129,7 +129,7 @@ public async Task Create(EditRemoteInstanceViewModel model) { await _service.CreateRemoteInstanceAsync(model.Name, model.Url, model.ClientName, model.ApiKey); - _notifier.Success(H["Remote instance created successfully."]); + await _notifier.SuccessAsync(H["Remote instance created successfully."]); return RedirectToAction(nameof(Index)); } @@ -187,7 +187,7 @@ public async Task Edit(EditRemoteInstanceViewModel model) { await _service.UpdateRemoteInstance(model.Id, model.Name, model.Url, model.ClientName, model.ApiKey); - _notifier.Success(H["Remote instance updated successfully."]); + await _notifier.SuccessAsync(H["Remote instance updated successfully."]); return RedirectToAction(nameof(Index)); } @@ -213,7 +213,7 @@ public async Task Delete(string id) await _service.DeleteRemoteInstanceAsync(id); - _notifier.Success(H["Remote instance deleted successfully."]); + await _notifier.SuccessAsync(H["Remote instance deleted successfully."]); return RedirectToAction(nameof(Index)); } @@ -241,7 +241,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn { await _service.DeleteRemoteInstanceAsync(item.Id); } - _notifier.Success(H["Remote instances successfully removed."]); + await _notifier.SuccessAsync(H["Remote instances successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs index 1ec919b1d7e..fc62510201e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs @@ -140,7 +140,7 @@ public async Task IndexBulkActionPOST(ContentOptions options, IEnu { _session.Delete(item); } - _notifier.Success(H["Deployment plans successfully deleted."]); + await _notifier.SuccessAsync(H["Deployment plans successfully deleted."]); break; default: throw new ArgumentOutOfRangeException(); @@ -298,7 +298,7 @@ public async Task Edit(EditDeploymentPlanViewModel model) _session.Save(deploymentPlan); - _notifier.Success(H["Deployment plan updated successfully."]); + await _notifier.SuccessAsync(H["Deployment plan updated successfully."]); return RedirectToAction(nameof(Index)); } @@ -324,7 +324,7 @@ public async Task Delete(int id) _session.Delete(deploymentPlan); - _notifier.Success(H["Deployment plan deleted successfully."]); + await _notifier.SuccessAsync(H["Deployment plan deleted successfully."]); return RedirectToAction(nameof(Index)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/ImportController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/ImportController.cs index 650a967f5da..7bd0734b33e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/ImportController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/ImportController.cs @@ -81,14 +81,14 @@ public async Task Import(IFormFile importedPackage) } else { - _notifier.Error(H["Only zip or json files are supported."]); + await _notifier.ErrorAsync(H["Only zip or json files are supported."]); return RedirectToAction(nameof(Index)); } await _deploymentManager.ImportDeploymentPackageAsync(new PhysicalFileProvider(tempArchiveFolder)); - _notifier.Success(H["Deployment package imported."]); + await _notifier.SuccessAsync(H["Deployment package imported."]); } finally { @@ -105,7 +105,7 @@ public async Task Import(IFormFile importedPackage) } else { - _notifier.Error(H["Please add a file to import."]); + await _notifier.ErrorAsync(H["Please add a file to import."]); } return RedirectToAction(nameof(Index)); @@ -145,7 +145,7 @@ public async Task Json(ImportJsonViewModel model) await _deploymentManager.ImportDeploymentPackageAsync(new PhysicalFileProvider(tempArchiveFolder)); - _notifier.Success(H["Recipe imported."]); + await _notifier.SuccessAsync(H["Recipe imported."]); } finally { diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs index 7ba50503f41..ebb873d6465 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs @@ -118,7 +118,7 @@ public async Task Create(EditDeploymentPlanStepViewModel model) deploymentPlan.DeploymentSteps.Add(step); _session.Save(deploymentPlan); - _notifier.Success(H["Deployment plan step added successfully."]); + await _notifier.SuccessAsync(H["Deployment plan step added successfully."]); return RedirectToAction("Display", "DeploymentPlan", new { id = model.DeploymentPlanId }); } @@ -191,11 +191,11 @@ public async Task Edit(EditDeploymentPlanStepViewModel model) { _session.Save(deploymentPlan); - _notifier.Success(H["Deployment plan step updated successfully."]); + await _notifier.SuccessAsync(H["Deployment plan step updated successfully."]); return RedirectToAction("Display", "DeploymentPlan", new { id = model.DeploymentPlanId }); } - _notifier.Error(H["The deployment plan step has validation errors."]); + await _notifier.ErrorAsync(H["The deployment plan step has validation errors."]); model.Editor = editor; // If we got this far, something failed, redisplay form @@ -227,7 +227,7 @@ public async Task Delete(int id, string stepId) deploymentPlan.DeploymentSteps.Remove(step); _session.Save(deploymentPlan); - _notifier.Success(H["Deployment step deleted successfully."]); + await _notifier.SuccessAsync(H["Deployment step deleted successfully."]); return RedirectToAction("Display", "DeploymentPlan", new { id }); } @@ -252,15 +252,15 @@ public async Task UpdateOrder(int id, int oldIndex, int newIndex) if (step == null) { return NotFound(); - } + } deploymentPlan.DeploymentSteps.RemoveAt(oldIndex); deploymentPlan.DeploymentSteps.Insert(newIndex, step); - + _session.Save(deploymentPlan); - return Ok(); - } + return Ok(); + } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Email/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Email/Controllers/AdminController.cs index fd40a44bd1c..137b56e1d98 100644 --- a/src/OrchardCore.Modules/OrchardCore.Email/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Email/Controllers/AdminController.cs @@ -62,7 +62,7 @@ public async Task IndexPost(SmtpSettingsViewModel model) } else { - _notifier.Success(H["Message sent successfully."]); + await _notifier.SuccessAsync(H["Message sent successfully."]); return Redirect(Url.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = SmtpSettingsDisplayDriver.GroupId })); } diff --git a/src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs index 69690a2289b..522e2a57826 100644 --- a/src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs @@ -166,11 +166,11 @@ private async Task EnableOrDisableFeaturesAsync(IEnumerable featur break; case FeaturesBulkAction.Enable: await _shellFeaturesManager.EnableFeaturesAsync(features, force == true); - Notify(features); + await NotifyAsync(features); break; case FeaturesBulkAction.Disable: await _shellFeaturesManager.DisableFeaturesAsync(features, force == true); - Notify(features, enabled: false); + await NotifyAsync(features, enabled: false); break; case FeaturesBulkAction.Toggle: var enabledFeatures = await _shellFeaturesManager.GetEnabledFeaturesAsync(); @@ -179,19 +179,19 @@ private async Task EnableOrDisableFeaturesAsync(IEnumerable featur var featuresToDisable = enabledFeatures.Intersect(features); await _shellFeaturesManager.UpdateFeaturesAsync(featuresToDisable, featuresToEnable, force == true); - Notify(featuresToEnable); - Notify(featuresToDisable, enabled: false); + await NotifyAsync(featuresToEnable); + await NotifyAsync(featuresToDisable, enabled: false); return; default: break; } } - private void Notify(IEnumerable features, bool enabled = true) + private async ValueTask NotifyAsync(IEnumerable features, bool enabled = true) { foreach (var feature in features) { - _notifier.Success(H["{0} was {1}.", feature.Name ?? feature.Id, enabled ? "enabled" : "disabled"]); + await _notifier.SuccessAsync(H["{0} was {1}.", feature.Name ?? feature.Id, enabled ? "enabled" : "disabled"]); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Features/Services/ModuleService.cs b/src/OrchardCore.Modules/OrchardCore.Features/Services/ModuleService.cs index 3d5f2b2e000..318fcf82960 100644 --- a/src/OrchardCore.Modules/OrchardCore.Features/Services/ModuleService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Features/Services/ModuleService.cs @@ -68,7 +68,7 @@ public async Task EnableFeaturesAsync(IEnumerable featureIds, bool force var enabledFeatures = await _shellFeaturesManager.EnableFeaturesAsync(featuresToEnable, force); foreach (var enabledFeature in enabledFeatures) { - _notifier.Success(H["{0} was enabled.", enabledFeature.Name]); + await _notifier.SuccessAsync(H["{0} was enabled.", enabledFeature.Name]); } } @@ -95,7 +95,7 @@ public async Task DisableFeaturesAsync(IEnumerable featureIds, bool forc var features = await _shellFeaturesManager.DisableFeaturesAsync(featuresToDisable, force); foreach (var feature in features) { - _notifier.Success(H["{0} was disabled.", feature.Name]); + await _notifier.SuccessAsync(H["{0} was disabled.", feature.Name]); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Https/Drivers/HttpsSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Https/Drivers/HttpsSettingsDisplayDriver.cs index f8ecd21d833..597de3c19e2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Https/Drivers/HttpsSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Https/Drivers/HttpsSettingsDisplayDriver.cs @@ -47,12 +47,12 @@ public override async Task EditAsync(HttpsSettings settings, Bui return null; } - return Initialize("HttpsSettings_Edit", model => + return Initialize("HttpsSettings_Edit", async model => { var isHttpsRequest = _httpContextAccessor.HttpContext.Request.IsHttps; if (!isHttpsRequest) - _notifier.Warning(H["For safety, Enabling require HTTPS over HTTP has been prevented."]); + await _notifier.WarningAsync(H["For safety, Enabling require HTTPS over HTTP has been prevented."]); model.EnableStrictTransportSecurity = settings.EnableStrictTransportSecurity; model.IsHttpsRequest = isHttpsRequest; diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs index c30a4aa0f91..1b68cb6d8e9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs @@ -256,11 +256,11 @@ public async Task Delete(string name) { layers.Layers.Remove(layer); await _layerService.UpdateAsync(layers); - _notifier.Success(H["Layer deleted successfully."]); + await _notifier.SuccessAsync(H["Layer deleted successfully."]); } else { - _notifier.Error(H["The layer couldn't be deleted: you must remove any associated widgets first."]); + await _notifier.ErrorAsync(H["The layer couldn't be deleted: you must remove any associated widgets first."]); } return RedirectToAction(nameof(Index)); diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs index 190e77ee67d..14481f92d18 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs @@ -131,7 +131,7 @@ public async Task Create(LayerRuleCreateViewModel model) _conditionIdGenerator.GenerateUniqueId(condition); conditionGroup.Conditions.Add(condition); await _layerService.UpdateAsync(layers); - _notifier.Success(H["Condition added successfully."]); + await _notifier.SuccessAsync(H["Condition added successfully."]); return RedirectToAction(nameof(Edit), "Admin", new { name = model.Name }); } @@ -200,11 +200,11 @@ public async Task Edit(LayerRuleEditViewModel model) if (ModelState.IsValid) { await _layerService.UpdateAsync(layers); - _notifier.Success(H["Condition updated successfully."]); + await _notifier.SuccessAsync(H["Condition updated successfully."]); return RedirectToAction(nameof(Edit), "Admin", new { name = model.Name }); } - _notifier.Error(H["The condition has validation errors."]); + await _notifier.ErrorAsync(H["The condition has validation errors."]); model.Editor = editor; // If we got this far, something failed, redisplay form @@ -238,7 +238,7 @@ public async Task Delete(string name, string conditionId) conditionParent.Conditions.Remove(condition); await _layerService.UpdateAsync(layers); - _notifier.Success(H["Condition deleted successfully."]); + await _notifier.SuccessAsync(H["Condition deleted successfully."]); return RedirectToAction(nameof(Edit), "Admin", new { name = name }); } @@ -265,14 +265,14 @@ public async Task UpdateOrder(string name, string conditionId, st if (condition == null || conditionParent == null || toCondition == null || !(toCondition is ConditionGroup toGroupCondition)) { return NotFound(); - } + } conditionParent.Conditions.Remove(condition); toGroupCondition.Conditions.Insert(toPosition, condition); - await _layerService.UpdateAsync(layers); + await _layerService.UpdateAsync(layers); - return Ok(); + return Ok(); } private Condition FindCondition(Condition condition, string conditionId) diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs index a48ebe31e0e..7020cd8e355 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs @@ -17,7 +17,7 @@ using OrchardCore.Settings; namespace OrchardCore.Localization.Drivers -{ +{ /// /// Represents a for the localization settings section in the admin site. /// @@ -121,7 +121,7 @@ public override async Task UpdateAsync(LocalizationSettings sect // We create a transient scope with the newly selected culture to create a notification that will use it instead of the previous culture using (CultureScope.Create(section.DefaultCulture)) { - _notifier.Warning(H["The site has been restarted for the settings to take effect."]); + await _notifier.WarningAsync(H["The site has been restarted for the settings to take effect."]); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Lucene/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Lucene/Controllers/AdminController.cs index 3c16a54e52d..5e1327dfb3a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lucene/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lucene/Controllers/AdminController.cs @@ -227,12 +227,12 @@ public async Task EditPost(LuceneIndexSettingsViewModel model, str } catch (Exception e) { - _notifier.Error(H["An error occurred while creating the index."]); + await _notifier.ErrorAsync(H["An error occurred while creating the index."]); _logger.LogError(e, "An error occurred while creating an index."); return View(model); } - _notifier.Success(H["Index {0} created successfully.", model.IndexName]); + await _notifier.SuccessAsync(H["Index {0} created successfully.", model.IndexName]); } else { @@ -244,12 +244,12 @@ public async Task EditPost(LuceneIndexSettingsViewModel model, str } catch (Exception e) { - _notifier.Error(H["An error occurred while editing the index."]); + await _notifier.ErrorAsync(H["An error occurred while editing the index."]); _logger.LogError(e, "An error occurred while editing an index."); return View(model); } - _notifier.Success(H["Index {0} modified successfully, please consider doing a rebuild on the index.", model.IndexName]); + await _notifier.SuccessAsync(H["Index {0} modified successfully, please consider doing a rebuild on the index.", model.IndexName]); } return RedirectToAction(nameof(Index)); @@ -278,7 +278,7 @@ public async Task Reset(string id) await _luceneIndexingService.ProcessContentItemsAsync(id); } - _notifier.Success(H["Index {0} reset successfully.", id]); + await _notifier.SuccessAsync(H["Index {0} reset successfully.", id]); } return RedirectToAction(nameof(Index)); @@ -299,7 +299,7 @@ public async Task Rebuild(string id) await _luceneIndexingService.RebuildIndexAsync(id); await _luceneIndexingService.ProcessContentItemsAsync(id); - _notifier.Success(H["Index {0} rebuilt successfully.", id]); + await _notifier.SuccessAsync(H["Index {0} rebuilt successfully.", id]); } else { @@ -325,11 +325,11 @@ public async Task Delete(LuceneIndexSettingsViewModel model) { await _luceneIndexingService.DeleteIndexAsync(model.IndexName); - _notifier.Success(H["Index {0} deleted successfully.", model.IndexName]); + await _notifier.SuccessAsync(H["Index {0} deleted successfully.", model.IndexName]); } catch (Exception e) { - _notifier.Error(H["An error occurred while deleting the index."]); + await _notifier.ErrorAsync(H["An error occurred while deleting the index."]); _logger.LogError("An error occurred while deleting the index " + model.IndexName, e); } } @@ -441,7 +441,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn { await _luceneIndexingService.DeleteIndexAsync(item.IndexName); } - _notifier.Success(H["Indices successfully removed."]); + await _notifier.SuccessAsync(H["Indices successfully removed."]); break; case ContentsBulkAction.Reset: foreach (var item in checkedContentItems) @@ -454,7 +454,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn _luceneIndexingService.ResetIndex(item.IndexName); await _luceneIndexingService.ProcessContentItemsAsync(item.IndexName); - _notifier.Success(H["Index {0} reset successfully.", item.IndexName]); + await _notifier.SuccessAsync(H["Index {0} reset successfully.", item.IndexName]); } break; case ContentsBulkAction.Rebuild: @@ -468,7 +468,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn await _luceneIndexingService.RebuildIndexAsync(item.IndexName); await _luceneIndexingService.ProcessContentItemsAsync(item.IndexName); - _notifier.Success(H["Index {0} rebuilt successfully.", item.IndexName]); + await _notifier.SuccessAsync(H["Index {0} rebuilt successfully.", item.IndexName]); } break; default: diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaCacheController.cs b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaCacheController.cs index 4b08de928cf..08c0e93608f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaCacheController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaCacheController.cs @@ -58,18 +58,18 @@ public async Task Purge() if (_mediaFileStoreCache == null) { - _notifier.Error(H["The asset cache feature is enabled, but a remote media store feature is not enabled, or not configured with appsettings.json."]); + await _notifier.ErrorAsync(H["The asset cache feature is enabled, but a remote media store feature is not enabled, or not configured with appsettings.json."]); RedirectToAction(nameof(Index)); } var hasErrors = await _mediaFileStoreCache.PurgeAsync(); if (hasErrors) { - _notifier.Error(H["Asset cache purged, with errors."]); + await _notifier.ErrorAsync(H["Asset cache purged, with errors."]); } else { - _notifier.Information(H["Asset cache purged."]); + await _notifier.InformationAsync(H["Asset cache purged."]); } return RedirectToAction(nameof(Index)); diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs index 5431e9b75c4..d55e05d442d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs @@ -286,7 +286,7 @@ public async Task Delete(string name) await _mediaProfilesManager.RemoveMediaProfileAsync(name); - _notifier.Success(H["Media profile deleted successfully."]); + await _notifier.SuccessAsync(H["Media profile deleted successfully."]); return RedirectToAction(nameof(Index)); } @@ -313,7 +313,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn { await _mediaProfilesManager.RemoveMediaProfileAsync(item.Key); } - _notifier.Success(H["Media profiles successfully removed."]); + await _notifier.SuccessAsync(H["Media profiles successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs index 0b865c464dc..c17bd91ad3a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs @@ -279,7 +279,7 @@ public async Task Delete(string menuContentItemId, string menuIte await _contentManager.SaveDraftAsync(menu); - _notifier.Success(H["Menu item deleted successfully."]); + await _notifier.SuccessAsync(H["Menu item deleted successfully."]); return RedirectToAction(nameof(Edit), "Admin", new { area = "OrchardCore.Contents", contentItemId = menuContentItemId }); } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs index ea5ff35a7d9..cfacec6dbfd 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs @@ -110,7 +110,7 @@ public async Task Create(string returnUrl = null) } else { - _notifier.Warning(H["There are no registered services to provide roles."]); + await _notifier.WarningAsync(H["There are no registered services to provide roles."]); } await foreach (var scope in _scopeManager.ListAsync(null, null, default)) @@ -120,7 +120,7 @@ public async Task Create(string returnUrl = null) Name = await _scopeManager.GetNameAsync(scope) }); } - + ViewData[nameof(OpenIdServerSettings)] = await GetServerSettingsAsync(); ViewData["ReturnUrl"] = returnUrl; return View(model); @@ -299,7 +299,7 @@ public async Task Edit(string id, string returnUrl = null) } else { - _notifier.Warning(H["There are no registered services to provide roles."]); + await _notifier.WarningAsync(H["There are no registered services to provide roles."]); } var permissions = await _applicationManager.GetPermissionsAsync(application); @@ -577,7 +577,7 @@ private async Task GetServerSettingsAsync() var settings = await service.GetSettingsAsync(); if ((await service.ValidateSettingsAsync(settings)).Any(result => result != ValidationResult.Success)) { - _notifier.Warning(H["OpenID Connect settings are not properly configured."]); + await _notifier.WarningAsync(H["OpenID Connect settings are not properly configured."]); } return settings; diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs index 2db10ab7d92..a377a8eb47d 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs @@ -93,7 +93,7 @@ public async Task IndexPost() await _serverService.UpdateSettingsAsync(settings); - _notifier.Success(H["OpenID server configuration successfully updated."]); + await _notifier.SuccessAsync(H["OpenID server configuration successfully updated."]); await _shellHost.ReleaseShellContextAsync(_shellSettings); diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs index 9fd173431e0..4d5c207581f 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs @@ -93,7 +93,7 @@ public async Task IndexPost() await _validationService.UpdateSettingsAsync(settings); - _notifier.Success(H["OpenID validation configuration successfully updated."]); + await _notifier.SuccessAsync(H["OpenID validation configuration successfully updated."]); await _shellHost.ReleaseShellContextAsync(_shellSettings); diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs index 412a1c1741a..debb7b9fc3d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs @@ -178,7 +178,7 @@ public async Task Edit(EditShapePlacementViewModel viewModel, str if (viewModel.Creating && await _placementsManager.GetShapePlacementsAsync(viewModel.ShapeType) != null) { // Prevent overriding existing rules on creation - _notifier.Warning(H["Placement rules for \"{0}\" already exists. Please edit existing rule.", viewModel.ShapeType]); + await _notifier.WarningAsync(H["Placement rules for \"{0}\" already exists. Please edit existing rule.", viewModel.ShapeType]); return View(viewModel); } @@ -195,28 +195,28 @@ public async Task Edit(EditShapePlacementViewModel viewModel, str await _placementsManager.UpdateShapePlacementsAsync(viewModel.ShapeType, placementNodes); viewModel.Creating = false; - _notifier.Success(H["The \"{0}\" placement have been saved.", viewModel.ShapeType]); + await _notifier.SuccessAsync(H["The \"{0}\" placement have been saved.", viewModel.ShapeType]); } else if (viewModel.Creating) { - _notifier.Warning(H["The \"{0}\" placement is empty.", viewModel.ShapeType]); + await _notifier.WarningAsync(H["The \"{0}\" placement is empty.", viewModel.ShapeType]); return View(viewModel); } else { // Remove if empty await _placementsManager.RemoveShapePlacementsAsync(viewModel.ShapeType); - _notifier.Success(H["The \"{0}\" placement has been deleted.", viewModel.ShapeType]); + await _notifier.SuccessAsync(H["The \"{0}\" placement has been deleted.", viewModel.ShapeType]); } } catch(JsonReaderException jsonException) { - _notifier.Error(H["An error occurred while parsing the placement
{0}", jsonException.Message]); + await _notifier.ErrorAsync(H["An error occurred while parsing the placement
{0}", jsonException.Message]); return View(viewModel); } catch (Exception e) { - _notifier.Error(H["An error occurred while saving the placement."]); + await _notifier.ErrorAsync(H["An error occurred while saving the placement."]); _logger.LogError(e, "An error occurred while saving the placement."); return View(viewModel); } @@ -238,7 +238,7 @@ public async Task Delete(string shapeType, string returnUrl = nul } await _placementsManager.RemoveShapePlacementsAsync(shapeType); - _notifier.Success(H["The \"{0}\" placement has been deleted.", shapeType]); + await _notifier.SuccessAsync(H["The \"{0}\" placement has been deleted.", shapeType]); return RedirectToReturnUrlOrIndex(returnUrl); } @@ -263,7 +263,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn { await _placementsManager.RemoveShapePlacementsAsync(item); } - _notifier.Success(H["Placements successfully removed."]); + await _notifier.SuccessAsync(H["Placements successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs index 43287880e06..3ad9e97d45a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs @@ -161,7 +161,7 @@ public async Task CreatePost(QueriesCreateViewModel model) { await _queryManager.SaveQueryAsync(query.Name, query); - _notifier.Success(H["Query created successfully."]); + await _notifier.SuccessAsync(H["Query created successfully."]); return RedirectToAction(nameof(Index)); } @@ -217,7 +217,7 @@ public async Task EditPost(QueriesEditViewModel model) { await _queryManager.SaveQueryAsync(model.Name, query); - _notifier.Success(H["Query updated successfully."]); + await _notifier.SuccessAsync(H["Query updated successfully."]); return RedirectToAction(nameof(Index)); } @@ -244,7 +244,7 @@ public async Task Delete(string id) await _queryManager.DeleteQueryAsync(id); - _notifier.Success(H["Query deleted successfully."]); + await _notifier.SuccessAsync(H["Query deleted successfully."]); return RedirectToAction(nameof(Index)); } @@ -271,7 +271,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn { await _queryManager.DeleteQueryAsync(item.Name); } - _notifier.Success(H["Queries successfully removed."]); + await _notifier.SuccessAsync(H["Queries successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Recipes/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Recipes/Controllers/AdminController.cs index 4228a5340e2..96312fc9146 100644 --- a/src/OrchardCore.Modules/OrchardCore.Recipes/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Recipes/Controllers/AdminController.cs @@ -101,7 +101,7 @@ public async Task Execute(string basePath, string fileName) if (recipe == null) { - _notifier.Error(H["Recipe was not found."]); + await _notifier.ErrorAsync(H["Recipe was not found."]); return RedirectToAction(nameof(Index)); } @@ -126,7 +126,7 @@ public async Task Execute(string basePath, string fileName) await _shellHost.ReleaseShellContextAsync(_shellSettings); - _notifier.Success(H["The recipe '{0}' has been run successfully.", recipe.DisplayName]); + await _notifier.SuccessAsync(H["The recipe '{0}' has been run successfully.", recipe.DisplayName]); return RedirectToAction(nameof(Index)); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs index 9f180a58f42..aae4ee9e9bd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs @@ -106,7 +106,7 @@ public async Task Create(CreateRoleViewModel model) var result = await _roleManager.CreateAsync(role); if (result.Succeeded) { - _notifier.Success(H["Role created successfully."]); + await _notifier.SuccessAsync(H["Role created successfully."]); return RedirectToAction(nameof(Index)); } @@ -141,17 +141,17 @@ public async Task Delete(string id) if (result.Succeeded) { - _notifier.Success(H["Role deleted successfully."]); + await _notifier.SuccessAsync(H["Role deleted successfully."]); } else { await _documentStore.CancelAsync(); - _notifier.Error(H["Could not delete this role."]); + await _notifier.ErrorAsync(H["Could not delete this role."]); foreach (var error in result.Errors) { - _notifier.Error(H[error.Description]); + await _notifier.ErrorAsync(H[error.Description]); } } @@ -219,7 +219,7 @@ public async Task EditPost(string id, string roleDescription) await _roleManager.UpdateAsync(role); - _notifier.Success(H["Role updated successfully."]); + await _notifier.SuccessAsync(H["Role updated successfully."]); return RedirectToAction(nameof(Index)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Controllers/AdminController.cs index 298acbe85c1..1729bfd192f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Controllers/AdminController.cs @@ -83,7 +83,7 @@ public async Task IndexPost(string groupId) // We create a transient scope with the newly selected culture to create a notification that will use it instead of the previous culture using (culture != null ? CultureScope.Create(culture) : null) { - _notifier.Success(H["Site settings updated successfully."]); + await _notifier.SuccessAsync(H["Site settings updated successfully."]); } return RedirectToAction(nameof(Index), new { groupId }); diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs index ba1d01bace9..6203009d897 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs @@ -297,7 +297,7 @@ public async Task Delete(string name) await _shortcodeTemplatesManager.RemoveShortcodeTemplateAsync(name); - _notifier.Success(H["Shortcode template deleted successfully."]); + await _notifier.SuccessAsync(H["Shortcode template deleted successfully."]); return RedirectToAction(nameof(Index)); } @@ -324,7 +324,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn { await _shortcodeTemplatesManager.RemoveShortcodeTemplateAsync(item.Key); } - _notifier.Success(H["Shortcode templates successfully removed."]); + await _notifier.SuccessAsync(H["Shortcode templates successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs index b2abd27c8c6..89991fbb8b3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs @@ -270,7 +270,7 @@ public async Task Edit(EditSitemapViewModel model) await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap updated successfully."]); + await _notifier.SuccessAsync(H["Sitemap updated successfully."]); return RedirectToAction(nameof(List)); } @@ -296,7 +296,7 @@ public async Task Delete(string sitemapId) await _sitemapManager.DeleteSitemapAsync(sitemapId); - _notifier.Success(H["Sitemap deleted successfully."]); + await _notifier.SuccessAsync(H["Sitemap deleted successfully."]); return RedirectToAction(nameof(List)); } @@ -320,7 +320,7 @@ public async Task Toggle(string sitemapId) await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap toggled successfully."]); + await _notifier.SuccessAsync(H["Sitemap toggled successfully."]); return RedirectToAction(nameof(List)); } @@ -347,7 +347,7 @@ public async Task ListPost(ViewModels.ContentOptions options, IEnu { await _sitemapManager.DeleteSitemapAsync(item.SitemapId); } - _notifier.Success(H["Sitemaps successfully removed."]); + await _notifier.SuccessAsync(H["Sitemaps successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapCacheController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapCacheController.cs index 8d05c07454e..718cbbbaffe 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapCacheController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapCacheController.cs @@ -57,11 +57,11 @@ public async Task PurgeAll() var hasErrors = await _sitemapCacheProvider.PurgeAllAsync(); if (hasErrors) { - _notifier.Error(H["Sitemap cache purged, with errors."]); + await _notifier.ErrorAsync(H["Sitemap cache purged, with errors."]); } else { - _notifier.Information(H["Sitemap cache purged."]); + await _notifier.InformationAsync(H["Sitemap cache purged."]); } return RedirectToAction(nameof(List)); @@ -78,11 +78,11 @@ public async Task Purge(string cacheFileName) var failed = await _sitemapCacheProvider.PurgeAsync(cacheFileName); if (failed) { - _notifier.Error(H["Error purging sitemap cache item."]); + await _notifier.ErrorAsync(H["Error purging sitemap cache item."]); } else { - _notifier.Information(H["Sitemap cache item purged."]); + await _notifier.InformationAsync(H["Sitemap cache item purged."]); } return RedirectToAction(nameof(List)); diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs index 8bfceec2f03..045d74c4744 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs @@ -181,7 +181,7 @@ public async Task Create(CreateSitemapIndexViewModel model) await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap index created successfully"]); + await _notifier.SuccessAsync(H["Sitemap index created successfully"]); return RedirectToAction(nameof(List)); } @@ -270,7 +270,7 @@ public async Task Edit(EditSitemapIndexViewModel model) await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap index updated successfully"]); + await _notifier.SuccessAsync(H["Sitemap index updated successfully"]); return RedirectToAction(nameof(List)); } @@ -296,7 +296,7 @@ public async Task Delete(string sitemapId) await _sitemapManager.DeleteSitemapAsync(sitemapId); - _notifier.Success(H["Sitemap index deleted successfully."]); + await _notifier.SuccessAsync(H["Sitemap index deleted successfully."]); return RedirectToAction(nameof(List)); } @@ -320,7 +320,7 @@ public async Task Toggle(string sitemapId) await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap index menu toggled successfully."]); + await _notifier.SuccessAsync(H["Sitemap index menu toggled successfully."]); return RedirectToAction(nameof(List)); } @@ -347,7 +347,7 @@ public async Task ListPost(ViewModels.ContentOptions options, IEnu { await _sitemapManager.DeleteSitemapAsync(item.SitemapId); } - _notifier.Success(H["Sitemap indices successfully removed."]); + await _notifier.SuccessAsync(H["Sitemap indices successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs index f46815cc7af..5956668fb31 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs @@ -122,7 +122,7 @@ public async Task Create(CreateSourceViewModel model) await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap source added successfully."]); + await _notifier.SuccessAsync(H["Sitemap source added successfully."]); return RedirectToAction("Display", "Admin", new { sitemapId = model.SitemapId }); } @@ -194,11 +194,11 @@ public async Task Edit(EditSourceViewModel model) { await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap source updated successfully."]); + await _notifier.SuccessAsync(H["Sitemap source updated successfully."]); return RedirectToAction("Display", "Admin", new { sitemapId = model.SitemapId }); } - _notifier.Error(H["The sitemap source has validation errors."]); + await _notifier.ErrorAsync(H["The sitemap source has validation errors."]); model.Editor = editor; // If we got this far, something failed, redisplay form @@ -231,7 +231,7 @@ public async Task Delete(string sitemapId, string sourceId) await _sitemapManager.UpdateSitemapAsync(sitemap); - _notifier.Success(H["Sitemap source deleted successfully."]); + await _notifier.SuccessAsync(H["Sitemap source deleted successfully."]); return RedirectToAction("Display", "Admin", new { sitemapId }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs index 492032dd64f..29744534ba8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs @@ -219,7 +219,7 @@ public async Task EditPost(string taxonomyContentItemId, string t var contentItem = await _contentManager.NewAsync(existing.ContentType); contentItem.ContentItemId = existing.ContentItemId; - contentItem.Merge(existing); + contentItem.Merge(existing); contentItem.Weld(); contentItem.Alter(t => t.TaxonomyContentItemId = taxonomyContentItemId); @@ -285,7 +285,7 @@ public async Task Delete(string taxonomyContentItemId, string tax taxonomyItem.Remove(); _session.Save(taxonomy); - _notifier.Success(H["Taxonomy item deleted successfully."]); + await _notifier.SuccessAsync(H["Taxonomy item deleted successfully."]); return RedirectToAction(nameof(Edit), "Admin", new { area = "OrchardCore.Contents", contentItemId = taxonomyContentItemId }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs index c3d38339965..8a6a35f2d58 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs @@ -181,7 +181,7 @@ public async Task CreatePost(TemplateViewModel model, string subm : _templatesManager.UpdateTemplateAsync(model.Name, template) ); - _notifier.Success(H["The \"{0}\" template has been created.", model.Name]); + await _notifier.SuccessAsync(H["The \"{0}\" template has been created.", model.Name]); if (submit == "SaveAndContinue") { @@ -323,7 +323,7 @@ public async Task Delete(string name, string returnUrl, bool admi ? _adminTemplatesManager.RemoveTemplateAsync(name) : _templatesManager.RemoveTemplateAsync(name)); - _notifier.Success(H["Template deleted successfully."]); + await _notifier.SuccessAsync(H["Template deleted successfully."]); return RedirectToReturnUrlOrIndex(returnUrl); } @@ -355,7 +355,7 @@ public async Task ListPost(ContentOptions options, IEnumerable Index(BulkActionViewModel model) case "Disable": if (String.Equals(shellSettings.Name, ShellHelper.DefaultShellName, StringComparison.OrdinalIgnoreCase)) { - _notifier.Warning(H["You cannot disable the default tenant."]); + await _notifier.WarningAsync(H["You cannot disable the default tenant."]); } else if (shellSettings.State != TenantState.Running) { - _notifier.Warning(H["The tenant '{0}' is already disabled.", shellSettings.Name]); + await _notifier.WarningAsync(H["The tenant '{0}' is already disabled.", shellSettings.Name]); } else { @@ -244,7 +244,7 @@ public async Task Index(BulkActionViewModel model) case "Enable": if (shellSettings.State != TenantState.Disabled) { - _notifier.Warning(H["The tenant '{0}' is already enabled.", shellSettings.Name]); + await _notifier.WarningAsync(H["The tenant '{0}' is already enabled.", shellSettings.Name]); } else { @@ -486,13 +486,13 @@ public async Task Disable(string id) if (String.Equals(shellSettings.Name, ShellHelper.DefaultShellName, StringComparison.OrdinalIgnoreCase)) { - _notifier.Error(H["You cannot disable the default tenant."]); + await _notifier.ErrorAsync(H["You cannot disable the default tenant."]); return RedirectToAction(nameof(Index)); } if (shellSettings.State != TenantState.Running) { - _notifier.Error(H["You can only disable an Enabled tenant."]); + await _notifier.ErrorAsync(H["You can only disable an Enabled tenant."]); return RedirectToAction(nameof(Index)); } @@ -526,7 +526,7 @@ public async Task Enable(string id) if (shellSettings.State != TenantState.Disabled) { - _notifier.Error(H["You can only enable a Disabled tenant."]); + await _notifier.ErrorAsync(H["You can only enable a Disabled tenant."]); } shellSettings.State = TenantState.Running; diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs index 9e866cefc66..572bd21fbe1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs @@ -157,10 +157,10 @@ public async Task SetCurrentTheme(string id) if (!isEnabled) { await _shellFeaturesManager.EnableFeaturesAsync(new[] { feature }, force: true); - _notifier.Success(H["{0} was enabled", feature.Name ?? feature.Id]); + await _notifier.SuccessAsync(H["{0} was enabled", feature.Name ?? feature.Id]); } - _notifier.Success(H["{0} was set as the default {1} theme", feature.Name ?? feature.Id, isAdmin ? "Admin" : "Site"]); + await _notifier.SuccessAsync(H["{0} was set as the default {1} theme", feature.Name ?? feature.Id, isAdmin ? "Admin" : "Site"]); } } @@ -177,7 +177,7 @@ public async Task ResetSiteTheme() await _siteThemeService.SetSiteThemeAsync(""); - _notifier.Success(H["The Site theme was reset."]); + await _notifier.SuccessAsync(H["The Site theme was reset."]); return RedirectToAction(nameof(Index)); } @@ -192,7 +192,7 @@ public async Task ResetAdminTheme() await _adminThemeService.SetAdminThemeAsync(""); - _notifier.Success(H["The Admin theme was reset."]); + await _notifier.SuccessAsync(H["The Admin theme was reset."]); return RedirectToAction(nameof(Index)); } @@ -214,7 +214,7 @@ public async Task Disable(string id) await _shellFeaturesManager.DisableFeaturesAsync(new[] { feature }, force: true); - _notifier.Success(H["{0} was disabled.", feature.Name ?? feature.Id]); + await _notifier.SuccessAsync(H["{0} was disabled.", feature.Name ?? feature.Id]); return RedirectToAction(nameof(Index)); } @@ -236,7 +236,7 @@ public async Task Enable(string id) await _shellFeaturesManager.EnableFeaturesAsync(new[] { feature }, force: true); - _notifier.Success(H["{0} was enabled.", feature.Name ?? feature.Id]); + await _notifier.SuccessAsync(H["{0} was enabled.", feature.Name ?? feature.Id]); return RedirectToAction(nameof(Index)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs index d8762e34173..747231a4aa8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs @@ -111,7 +111,7 @@ public async Task EnableFeaturesAsync(IEnumerable featureIds, bool force var enabledFeatures = await _shellFeaturesManager.EnableFeaturesAsync(featuresToEnable, force); foreach (var enabledFeature in enabledFeatures) { - _notifier.Success(H["{0} was enabled.", enabledFeature.Name]); + await _notifier.SuccessAsync(H["{0} was enabled.", enabledFeature.Name]); } } @@ -138,7 +138,7 @@ public async Task DisableFeaturesAsync(IEnumerable featureIds, bool forc var features = await _shellFeaturesManager.DisableFeaturesAsync(featuresToDisable, force); foreach (var feature in features) { - _notifier.Success(H["{0} was disabled.", feature.Name]); + await _notifier.SuccessAsync(H["{0} was disabled.", feature.Name]); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs index 1f2807ed9cb..6e96d8b89b6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs @@ -271,7 +271,7 @@ public async Task ChangePassword(ChangePasswordViewModel model, s { if (Url.IsLocalUrl(returnUrl)) { - _notifier.Success(H["Your password has been changed successfully."]); + await _notifier.SuccessAsync(H["Your password has been changed successfully."]); return Redirect(returnUrl); } else diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs index f4e4b9a47dd..f38cfcc7b9a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs @@ -254,7 +254,7 @@ public async Task IndexPOST(UserIndexOptions options, IEnumerable< { var token = await _userManager.GenerateEmailConfirmationTokenAsync(user); await _userManager.ConfirmEmailAsync(user, token); - _notifier.Success(H["User {0} successfully approved.", user.UserName]); + await _notifier.SuccessAsync(H["User {0} successfully approved.", user.UserName]); } } break; @@ -266,7 +266,7 @@ public async Task IndexPOST(UserIndexOptions options, IEnumerable< continue; } await _userManager.DeleteAsync(user); - _notifier.Success(H["User {0} successfully deleted.", user.UserName]); + await _notifier.SuccessAsync(H["User {0} successfully deleted.", user.UserName]); } break; case UsersBulkAction.Disable: @@ -278,7 +278,7 @@ public async Task IndexPOST(UserIndexOptions options, IEnumerable< } user.IsEnabled = false; await _userManager.UpdateAsync(user); - _notifier.Success(H["User {0} successfully disabled.", user.UserName]); + await _notifier.SuccessAsync(H["User {0} successfully disabled.", user.UserName]); } break; case UsersBulkAction.Enable: @@ -290,7 +290,7 @@ public async Task IndexPOST(UserIndexOptions options, IEnumerable< } user.IsEnabled = true; await _userManager.UpdateAsync(user); - _notifier.Success(H["User {0} successfully enabled.", user.UserName]); + await _notifier.SuccessAsync(H["User {0} successfully enabled.", user.UserName]); } break; default: @@ -339,7 +339,7 @@ public async Task CreatePost() return View(shape); } - _notifier.Success(H["User created successfully."]); + await _notifier.SuccessAsync(H["User created successfully."]); return RedirectToAction(nameof(Index)); } @@ -427,7 +427,7 @@ public async Task EditPost(string id, string returnUrl) await _signInManager.RefreshSignInAsync(user); } - _notifier.Success(H["User updated successfully."]); + await _notifier.SuccessAsync(H["User updated successfully."]); if (editingOwnUser) { @@ -468,17 +468,17 @@ public async Task Delete(string id) if (result.Succeeded) { - _notifier.Success(H["User deleted successfully."]); + await _notifier.SuccessAsync(H["User deleted successfully."]); } else { await _session.CancelAsync(); - _notifier.Error(H["Could not delete the user."]); + await _notifier.ErrorAsync(H["Could not delete the user."]); foreach (var error in result.Errors) { - _notifier.Error(H[error.Description]); + await _notifier.ErrorAsync(H[error.Description]); } } @@ -525,7 +525,7 @@ public async Task EditPassword(ResetPasswordViewModel model) if (await _userService.ResetPasswordAsync(model.Email, token, model.NewPassword, ModelState.AddModelError)) { - _notifier.Success(H["Password updated correctly."]); + await _notifier.SuccessAsync(H["Password updated correctly."]); return RedirectToAction(nameof(Index)); } @@ -553,14 +553,14 @@ public async Task Unlock(string id) var result = await _userManager.SetLockoutEndDateAsync(user, null); if (result.Succeeded) - { - _notifier.Success(H["User unlocked successfully."]); + { + await _notifier.SuccessAsync(H["User unlocked successfully."]); } else { await _session.CancelAsync(); - _notifier.Error(H["Could not unlock the user."]); + await _notifier.ErrorAsync(H["Could not unlock the user."]); foreach (var error in result.Errors) { diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs index f1047ef6f46..5a78c4224ad 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs @@ -170,7 +170,7 @@ public async Task SendVerificationEmail(string id) { await this.SendEmailConfirmationTokenAsync(user, S["Confirm your account"]); - _notifier.Success(H["Verification email sent."]); + await _notifier.SuccessAsync(H["Verification email sent."]); } return RedirectToAction(nameof(AdminController.Index), "Admin"); diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs index 8dc0c5b3afb..61e8c9e6214 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs @@ -93,7 +93,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo var usersOfAdminRole = (await _userManager.GetUsersInRoleAsync(AdministratorRole)).Cast(); ; if (usersOfAdminRole.Count() == 1 && String.Equals(user.UserId, usersOfAdminRole.First().UserId, StringComparison.OrdinalIgnoreCase)) { - _notifier.Warning(H["Cannot disable the only administrator."]); + await _notifier.WarningAsync(H["Cannot disable the only administrator."]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs index 9c93dd4e13a..54d9ff5d9cb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs @@ -53,7 +53,7 @@ public override IDisplayResult Edit(User user) return Initialize("UserRoleFields_Edit", async model => { // The current user can only view their roles if they have list users, to prevent listing roles when managing their own profile. - if (String.Equals(_httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier), user.UserId, StringComparison.OrdinalIgnoreCase) && + if (String.Equals(_httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier), user.UserId, StringComparison.OrdinalIgnoreCase) && !await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext.User, Permissions.ViewUsers)) { return; @@ -68,10 +68,10 @@ public override IDisplayResult Edit(User user) var roleEntries = new List(); foreach(var roleName in roleNames) { - var roleEntry = new RoleEntry - { - Role = roleName, - IsSelected = userRoleNames.Contains(roleName, StringComparer.OrdinalIgnoreCase) + var roleEntry = new RoleEntry + { + Role = roleName, + IsSelected = userRoleNames.Contains(roleName, StringComparer.OrdinalIgnoreCase) }; if (!authorizedRoleNames.Contains(roleName, StringComparer.OrdinalIgnoreCase)) @@ -82,7 +82,7 @@ public override IDisplayResult Edit(User user) roleEntries.Add(roleEntry); } - model.Roles = roleEntries.ToArray(); + model.Roles = roleEntries.ToArray(); }) .Location("Content:1.10"); } @@ -133,7 +133,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo // Make sure we always have at least one administrator account if (usersOfAdminRole.Count() == 1 && String.Equals(user.UserId, usersOfAdminRole.First().UserId, StringComparison.OrdinalIgnoreCase)) { - _notifier.Warning(H["Cannot remove administrator role from the only administrator."]); + await _notifier.WarningAsync(H["Cannot remove administrator role from the only administrator."]); continue; } else diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/NotifyTask.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/NotifyTask.cs index 973ce28f265..412fe8b034a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/NotifyTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/NotifyTask.cs @@ -55,7 +55,7 @@ public override IEnumerable GetPossibleOutcomes(WorkflowExecutionContex public override async Task ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { var message = await _expressionEvaluator.EvaluateAsync(Message, workflowContext, _htmlEncoder); - _notifier.Add(NotificationType, new LocalizedHtmlString(nameof(NotifyTask), message)); + await _notifier.AddAsync(NotificationType, new LocalizedHtmlString(nameof(NotifyTask), message)); return Outcomes("Done"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/ActivityController.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/ActivityController.cs index 8184a95b814..2f3d0b26553 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/ActivityController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/ActivityController.cs @@ -109,7 +109,7 @@ public async Task Create(string activityName, ActivityEditViewMod workflowType.Activities.Add(activityRecord); _session.Save(workflowType); - _notifier.Success(H["Activity added successfully."]); + await _notifier.SuccessAsync(H["Activity added successfully."]); return Url.IsLocalUrl(model.ReturnUrl) ? (IActionResult)Redirect(model.ReturnUrl) : RedirectToAction(nameof(Edit), "WorkflowType", new { id = model.WorkflowTypeId }); } @@ -165,7 +165,7 @@ public async Task Edit(ActivityEditViewModel model) activityRecord.Properties = activityContext.Activity.Properties; _session.Save(workflowType); - _notifier.Success(H["Activity updated successfully."]); + await _notifier.SuccessAsync(H["Activity updated successfully."]); return Url.IsLocalUrl(model.ReturnUrl) ? (IActionResult)Redirect(model.ReturnUrl) diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs index 003da409272..9702a8185af 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs @@ -240,7 +240,7 @@ public async Task Delete(int id) var workflowType = await _workflowTypeStore.GetAsync(workflow.WorkflowTypeId); await _workflowStore.DeleteAsync(workflow); - _notifier.Success(H["Workflow {0} has been deleted.", id]); + await _notifier.SuccessAsync(H["Workflow {0} has been deleted.", id]); return RedirectToAction(nameof(Index), new { workflowTypeId = workflowType.Id }); } @@ -269,7 +269,7 @@ public async Task BulkEdit(int workflowTypeId, WorkflowIndexOptio if (workflow != null) { await _workflowStore.DeleteAsync(workflow); - _notifier.Success(H["Workflow {0} has been deleted.", workflow.Id]); + await _notifier.SuccessAsync(H["Workflow {0} has been deleted.", workflow.Id]); } } break; diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs index efcd854166f..7eac931771c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs @@ -194,7 +194,7 @@ public async Task BulkEdit(WorkflowTypeIndexOptions options, IEnu if (workflowType != null) { await _workflowTypeStore.DeleteAsync(workflowType); - _notifier.Success(H["Workflow {0} has been deleted.", workflowType.Name]); + await _notifier.SuccessAsync(H["Workflow {0} has been deleted.", workflowType.Name]); } } break; @@ -461,7 +461,7 @@ from activityId in currentActivities.Keys } await _workflowTypeStore.SaveAsync(workflowType); - _notifier.Success(H["Workflow has been saved."]); + await _notifier.SuccessAsync(H["Workflow has been saved."]); return RedirectToAction(nameof(Edit), new { id = model.Id }); } @@ -482,7 +482,7 @@ public async Task Delete(int id) } await _workflowTypeStore.DeleteAsync(workflowType); - _notifier.Success(H["Workflow {0} deleted", workflowType.Name]); + await _notifier.SuccessAsync(H["Workflow {0} deleted", workflowType.Name]); return RedirectToAction(nameof(Index)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs index 2029b73468e..5e26c70aaca 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs @@ -69,7 +69,7 @@ public override async Task UpdateAsync(ContentItem model, IUpdat if (!availableActions.Contains(action)) { - _notifier.Error(H["Not authorized to trigger '{0}'.", action]); + await _notifier.ErrorAsync(H["Not authorized to trigger '{0}'.", action]); } else { diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs index 58ff9214cf4..1d1b8631e1f 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs @@ -1,4 +1,6 @@ +using System; using System.Collections.Generic; +using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Localization; namespace OrchardCore.DisplayManagement.Notify @@ -18,8 +20,27 @@ public interface INotifier /// /// The type of the notification (notifications with different types can be displayed differently) /// A localized message to display + [Obsolete("This method will be removed in a later version. Use AddAsync()")] void Add(NotifyType type, LocalizedHtmlString message); + /// + /// Adds a new UI notification asynchronously. + /// + /// + /// The type of the notification (notifications with different types can be displayed differently) + /// A localized message to display + /// + /// Added with a default interface implementation for backwards compatability. + /// + ValueTask AddAsync(NotifyType type, LocalizedHtmlString message) + { +#pragma warning disable CS0618 // Type or member is obsolete + Add(type, message); +#pragma warning restore CS0618 // Type or member is obsolete + + return new ValueTask(); + } + /// /// Get all notifications added /// diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs index 1aba950a7ad..d4af89f6839 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.Localization; using Microsoft.Extensions.Logging; @@ -15,6 +16,9 @@ public Notifier(ILogger logger) _logger = logger; } + [Obsolete("This method will be removed in a later version. Use AddAsync()")] + // TODO The implementation for this is provided as an interface default implementation + // when the interface method is removed, replace this with AddAsync. public void Add(NotifyType type, LocalizedHtmlString message) { if (_logger.IsEnabled(LogLevel.Information)) diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifierExtensions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifierExtensions.cs index acec95620ea..ad71560f8f7 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifierExtensions.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifierExtensions.cs @@ -1,3 +1,5 @@ +using System; +using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Localization; namespace OrchardCore.DisplayManagement.Notify @@ -10,42 +12,82 @@ public static class NotifierExtensions /// /// The /// A localized message to display + [Obsolete("This method will be removed in a later version. Use InformationAsync()")] public static void Information(this INotifier notifier, LocalizedHtmlString message) { notifier.Add(NotifyType.Information, message); } + /// + /// Adds a new UI notification of type Information + /// + /// + /// The + /// A localized message to display + public static ValueTask InformationAsync(this INotifier notifier, LocalizedHtmlString message) + => notifier.AddAsync(NotifyType.Information, message); + /// /// Adds a new UI notification of type Warning /// /// /// The /// A localized message to display + [Obsolete("This method will be removed in a later version. Use WarningAsync()")] public static void Warning(this INotifier notifier, LocalizedHtmlString message) { notifier.Add(NotifyType.Warning, message); } + /// + /// Adds a new UI notification of type Warning + /// + /// + /// The + /// A localized message to display + public static ValueTask WarningAsync(this INotifier notifier, LocalizedHtmlString message) + => notifier.AddAsync(NotifyType.Warning, message); + /// /// Adds a new UI notification of type Error /// /// /// The /// A localized message to display + [Obsolete("This method will be removed in a later version. Use ErrorAsync()")] public static void Error(this INotifier notifier, LocalizedHtmlString message) { notifier.Add(NotifyType.Error, message); } + /// + /// Adds a new UI notification of type Error + /// + /// + /// The + /// A localized message to display + public static ValueTask ErrorAsync(this INotifier notifier, LocalizedHtmlString message) + => notifier.AddAsync(NotifyType.Error, message); + /// /// Adds a new UI notification of type Success /// /// /// The /// A localized message to display + [Obsolete("This method will be removed in a later version. Use SuccessAsync()")] public static void Success(this INotifier notifier, LocalizedHtmlString message) { notifier.Add(NotifyType.Success, message); } + + /// + /// Adds a new UI notification of type Success + /// + /// + /// The + /// A localized message to display + public static ValueTask SuccessAsync(this INotifier notifier, LocalizedHtmlString message) + => notifier.AddAsync(NotifyType.Success, message); } }