changing the Account now updates Flex roles in the UI

This commit is contained in:
t.ruspekhofer 2022-03-16 22:29:33 +01:00
parent bca069db78
commit 408f09f650
4 changed files with 50 additions and 33 deletions

View file

@ -18,10 +18,10 @@
@if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}";
}
@if (isUser && _usableAccounts.Count > 1)
@if (isUser && _usableAccounts.Count > 1 && signUp.SignUpType != SignUpType.Flex)
{
<td>@signUp.LiebUser.Name
<select value=@signUp.GuildWars2AccountId @onchange="args => ChangeAccount(args)">
<select value=@signUp.GuildWars2AccountId @onchange="args => _Parent.ChangeAccount(args)">
@foreach (var account in _usableAccounts)
{
<option value=@account.GuildWars2AccountId>@account.AccountName</option>
@ -37,6 +37,8 @@
}
</table>
@code {
[CascadingParameter]
public RaidRoles _Parent { get; set; }
[Parameter]
public Raid _raid { get; set; }
@ -49,12 +51,4 @@
[Parameter]
public int _currentRoleId { get; set; }
async Task ChangeAccount(ChangeEventArgs e)
{
int accountId = int.Parse(e.Value.ToString());
await RaidService.ChangeAccount(_raid.RaidId, _liebUserId, accountId);
_raid = RaidService.GetRaid(_raid.RaidId);
}
}