Added SettingManagerExtensions

pull/301/head
Halil İbrahim Kalkan 7 years ago
parent b71ed66c3f
commit b3b6e0153c

@ -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; }

@ -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<bool> 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
);
}
}
}
Loading…
Cancel
Save