Added main account select
This commit is contained in:
parent
c4ecb512d7
commit
85eaf8b36e
2 changed files with 35 additions and 27 deletions
|
@ -95,16 +95,7 @@ namespace Lieb.Data
|
||||||
public async Task EditUser(LiebUser user)
|
public async Task EditUser(LiebUser user)
|
||||||
{
|
{
|
||||||
using var context = _contextFactory.CreateDbContext();
|
using var context = _contextFactory.CreateDbContext();
|
||||||
LiebUser? userToChange = context.LiebUsers
|
context.Update(user);
|
||||||
.Include(u => u.GuildWars2Accounts)
|
|
||||||
.FirstOrDefault(u => u.Id == user.Id);
|
|
||||||
|
|
||||||
if(userToChange != null)
|
|
||||||
{
|
|
||||||
userToChange.Name = user.Name;
|
|
||||||
userToChange.Pronouns = user.Pronouns;
|
|
||||||
userToChange.Birthday = user.Birthday;
|
|
||||||
}
|
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
await _discordService.RenameUser(user.Id, user.Name, GetMainAccount(user.Id).AccountName);
|
await _discordService.RenameUser(user.Id, user.Name, GetMainAccount(user.Id).AccountName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,26 +36,39 @@
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div class="nav-item px-3">
|
||||||
|
<NavLink class="nav-link" href="gw2accountedit">
|
||||||
|
<span class="oi oi-plus" aria-hidden="true"></span> Add Guild Wars 2 Account
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Main Account</th>
|
||||||
|
<th>Edit</th>
|
||||||
|
</tr>
|
||||||
|
<InputRadioGroup @bind-Value="_user.MainGW2Account">
|
||||||
|
@foreach(GuildWars2Account account in _user.GuildWars2Accounts)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<InputRadio Value="@account.GuildWars2AccountId" /> @account.AccountName
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="nav-item px-3">
|
||||||
|
@{string navLink = $"gw2accountedit/{@account.GuildWars2AccountId}";}
|
||||||
|
<NavLink class="nav-link" href="@navLink">Edit</NavLink>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</InputRadioGroup>
|
||||||
|
</table>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<button type="submit">Save</button>
|
<button type="submit">Save</button>
|
||||||
<ValidationSummary />
|
<ValidationSummary />
|
||||||
|
|
||||||
</EditForm>
|
</EditForm>
|
||||||
|
|
||||||
<br />
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="gw2accountedit">
|
|
||||||
<span class="oi oi-plus" aria-hidden="true"></span> Add Guild Wars 2 Account
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@foreach(GuildWars2Account account in _user.GuildWars2Accounts)
|
|
||||||
{
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
@{string navLink = $"gw2accountedit/{@account.GuildWars2AccountId}";}
|
|
||||||
<NavLink class="nav-link" href="@navLink">@account.AccountName</NavLink>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</Authorized>
|
</Authorized>
|
||||||
</AuthorizeView>
|
</AuthorizeView>
|
||||||
|
|
||||||
|
@ -73,6 +86,10 @@
|
||||||
_user = UserService.GetLiebUserGW2AccountOnly(discordId);
|
_user = UserService.GetLiebUserGW2AccountOnly(discordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async Task Changed(int buildId, ChangeEventArgs args)
|
||||||
|
{
|
||||||
|
bool canTank = bool.Parse(args.Value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
private async Task HandleValidSubmit()
|
private async Task HandleValidSubmit()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue