modif prcq j'avais rien compris a la configuration

blazor
Patrick BRUGIERE 1 year ago
parent 81d372e21d
commit 03c4df537e

@ -0,0 +1,13 @@
using System.Data;
namespace adminBlazor.Models
{
public class CreatorOptions
{
public const string Creators = "Creators";
public List<string> Name { get; set; }
}
}

@ -1,30 +0,0 @@
using System.Data;
namespace adminBlazor.Models
{
public class UserOptions
{
public const string User = "User";
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Nickname { get; set; }
public bool ExtraTime { get; set; }
public int Group { get; set; }
public List<string> Roles { get; set; }
public UserOptions()
{
// Constructeur sans paramètre public
Id = 1;
Name = "DefaultName";
Surname = "DefaultSurname";
Nickname = "DefaultNickname";
ExtraTime = false;
Group = 0;
Roles = new List<string>();
}
}
}

@ -2,15 +2,25 @@
<h3>Config</h3> <h3>Config</h3>
@if (userOptions != null) @if (creatorOptions != null)
{ {
<div> <div>
<div>Title: @userOptions.id</div> <div>Logging:LogLevel:Default: @Configuration["Logging:LogLevel:Default"]</div>
<div>Name: @userOptions.name</div> <div>Logging:LogLevel:Default: @Configuration["Logging:LogLevel:Microsoft.AspNetCore"]</div>
<div>Surname: @userOptions.Surname</div>
<div>Nickname: @userOptions.Nickname</div> <h4>Noms des créateurs</h4>
<div>ExtraTime: @userOptions.ExtraTime</div> @if (creatorOptions.Name != null)
<div>Group: @userOptions.Group</div> {
<div>Roles: @string.Join(", ", userOptions.Roles)</div> @foreach (var creator in creatorOptions.Name)
{
<div>@creator</div>
}
}
else
{
<div>No creators found</div>
}
</div> </div>
} }

@ -9,14 +9,19 @@ namespace adminBlazor.Pages
public IConfiguration Configuration { get; set; } public IConfiguration Configuration { get; set; }
private UserOptions userOptions; private CreatorOptions creatorOptions;
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized(); base.OnInitialized();
userOptions = new UserOptions(); creatorOptions = new CreatorOptions();
Configuration.GetSection(UserOptions.User).Bind(userOptions); Configuration.GetSection(CreatorOptions.Creators).Bind(creatorOptions);
if (creatorOptions.Name == null)
{
return;
}
} }
} }

@ -5,6 +5,7 @@
<a href="/list">@Localizer["Users"]</a> <a href="/list">@Localizer["Users"]</a>
<a href="/account">@Localizer["My account"]</a> <a href="/account">@Localizer["My account"]</a>
<a href="/voc">@Localizer["Vocabulary Lists"]</a> <a href="/voc">@Localizer["Vocabulary Lists"]</a>
<a href="/config">@Localizer["Config"]</a>
</div> </div>

@ -1,4 +1,12 @@
{ {
"Creators": {
"Name": [
"Patrick Brugière",
"Anthony Richard",
"Antoine Jourdain",
"Lucie Goigoux"
]
},
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
@ -6,5 +14,6 @@
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*"
} }

Loading…
Cancel
Save