mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc.Routing;
|
|
using Microsoft.AspNetCore.Routing;
|
|
using Volo.Abp.DependencyInjection;
|
|
using Volo.Abp.Features;
|
|
using Volo.CmsKit.Features;
|
|
using Volo.CmsKit.Public.Pages;
|
|
|
|
namespace Volo.CmsKit.Public.Web.Pages;
|
|
|
|
public class CmsKitHomePageRouteValueTransformer : DynamicRouteValueTransformer, ITransientDependency
|
|
{
|
|
protected IFeatureChecker FeatureChecker { get; }
|
|
|
|
protected IPagePublicAppService PagePublicAppService { get; }
|
|
|
|
public CmsKitHomePageRouteValueTransformer(IFeatureChecker featureChecker, IPagePublicAppService pagePublicAppService)
|
|
{
|
|
FeatureChecker = featureChecker;
|
|
PagePublicAppService = pagePublicAppService;
|
|
}
|
|
|
|
public override async ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
|
|
{
|
|
if (await FeatureChecker.IsEnabledAsync(CmsKitFeatures.PageEnable))
|
|
{
|
|
var page = await PagePublicAppService.FindDefaultHomePageAsync();
|
|
if (page is not null)
|
|
{
|
|
values = new RouteValueDictionary();
|
|
|
|
values["page"] = "/Public/CmsKit/Pages/Index";
|
|
values["slug"] = page.Slug;
|
|
}
|
|
}
|
|
|
|
return values;
|
|
}
|
|
}
|
|
|