diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI/RazorPages/AbpPageModel.cs b/src/Volo.Abp.AspNetCore.Mvc.UI/RazorPages/AbpPageModel.cs index 0c04daed5e..3fe7c81536 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI/RazorPages/AbpPageModel.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI/RazorPages/AbpPageModel.cs @@ -11,6 +11,7 @@ using Volo.Abp.AspNetCore.Mvc.Validation; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; +using Volo.Abp.Settings; using Volo.Abp.Timing; using Volo.Abp.Uow; using Volo.Abp.Users; @@ -31,6 +32,8 @@ namespace Volo.Abp.AspNetCore.Mvc.RazorPages public ICurrentTenant CurrentTenant { get; set; } + public ISettingManager SettingManager { get; set; } + public IModelStateValidator ModelValidator { get; set; } public IAuthorizationService AuthorizationService { get; set; } diff --git a/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerExtensions.cs b/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerExtensions.cs new file mode 100644 index 0000000000..11aa6f05c2 --- /dev/null +++ b/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerExtensions.cs @@ -0,0 +1,21 @@ +using System; +using System.Threading.Tasks; +using JetBrains.Annotations; + +namespace Volo.Abp.Settings +{ + public static class SettingManagerExtensions + { + public static async Task IsTrueAsync([NotNull] this ISettingManager settingManager, [NotNull] string name) + { + Check.NotNull(settingManager, nameof(settingManager)); + Check.NotNull(name, nameof(name)); + + return string.Equals( + await settingManager.GetOrNullAsync(name), + "true", + StringComparison.OrdinalIgnoreCase + ); + } + } +} \ No newline at end of file