diff --git a/Helper/ConfigHelper.cs b/Helper/ConfigHelper.cs deleted file mode 100644 index f59e62b..0000000 --- a/Helper/ConfigHelper.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CarCareTracker.Models; - -namespace CarCareTracker.Helper -{ - public interface IConfigHelper - { - UserConfig GetUserConfig(bool userIsAdmin, int userId); - } - public class ConfigHelper : IConfigHelper - { - private readonly IConfiguration _config; - public ConfigHelper(IConfiguration serverConfiguration) - { - _config = serverConfiguration; - } - public UserConfig GetUserConfig(bool isRootUser, int userId) - { - if (isRootUser) - { - var serverConfig = new UserConfig - { - EnableCsvImports = bool.Parse(_config[nameof(UserConfig.EnableCsvImports)]), - UseDarkMode = bool.Parse(_config[nameof(UserConfig.UseDarkMode)]), - UseMPG = bool.Parse(_config[nameof(UserConfig.UseMPG)]), - UseDescending = bool.Parse(_config[nameof(UserConfig.UseDescending)]), - EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]), - HideZero = bool.Parse(_config[nameof(UserConfig.HideZero)]), - UseUKMPG = bool.Parse(_config[nameof(UserConfig.UseUKMPG)]) - }; - return serverConfig; - } else - { - return new UserConfig(); - } - } - } -} diff --git a/Views/Home/Index.cshtml b/Views/Home/Index.cshtml index 2dd47ce..892e543 100644 --- a/Views/Home/Index.cshtml +++ b/Views/Home/Index.cshtml @@ -14,9 +14,12 @@ - + @if (User.IsInRole(nameof(UserData.IsRootUser))) + { + + } @if (enableAuth) { - + @if (User.IsInRole(nameof(UserData.IsRootUser))) + { + + } @if (enableAuth) { - }