diff --git a/Lombiq.JsonEditor/Controllers/AdminController.cs b/Lombiq.JsonEditor/Controllers/AdminController.cs index ed8b29b..10b8420 100644 --- a/Lombiq.JsonEditor/Controllers/AdminController.cs +++ b/Lombiq.JsonEditor/Controllers/AdminController.cs @@ -1,6 +1,7 @@ using AngleSharp.Common; using Lombiq.HelpfulLibraries.OrchardCore.Contents; using Lombiq.HelpfulLibraries.OrchardCore.DependencyInjection; +using Lombiq.HelpfulLibraries.OrchardCore.Mvc; using Lombiq.JsonEditor.ViewModels; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -57,6 +58,7 @@ public AdminController( H = services.HtmlLocalizer.Value; } + [AdminRoute("Contents/ContentItems/{contentItemId}/Edit/Json")] public async Task Edit(string contentItemId) { if (string.IsNullOrWhiteSpace(contentItemId) || diff --git a/Lombiq.JsonEditor/Startup.cs b/Lombiq.JsonEditor/Startup.cs index eaad775..131959f 100644 --- a/Lombiq.JsonEditor/Startup.cs +++ b/Lombiq.JsonEditor/Startup.cs @@ -1,4 +1,5 @@ using Lombiq.HelpfulLibraries.OrchardCore.DependencyInjection; +using Lombiq.HelpfulLibraries.OrchardCore.Mvc; using Lombiq.JsonEditor.Constants; using Lombiq.JsonEditor.Drivers; using Lombiq.JsonEditor.Fields; @@ -48,12 +49,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddOrchardServices(); services.AddScoped(); services.AddContentSecurityPolicyProvider(); + AdminRouteAttributeRouteMapper.AddToServices(services); } - - public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) => - routes.MapAreaControllerRoute( - name: "EditContentItem", - areaName: FeatureIds.Area, - pattern: _adminOptions.AdminUrlPrefix + "/Contents/ContentItems/{contentItemId}/Edit/Json", - defaults: new { controller = typeof(AdminController).ControllerName(), action = nameof(AdminController.Edit) }); }