button add is OK

teams
samuel 10 months ago committed by sam
parent 0a9f7db736
commit 98e6386d36

@ -12,7 +12,7 @@
<MudTextField T="string" Label="MainColor" Required="true" @bind-Value="FormMainColor" RequiredError="Main color is required!"/>
<MudTextField T="string" Label="SecondaryColor" Required="true" @bind-Value="FormSecondaryColor" RequiredError="Secondary color is required!"/>
<div class="d-flex justify-center">
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@AddTeam" Class="ml-auto">Apply</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@AddTeamConfirmed" Class="ml-auto">Apply</MudButton>
</div>
</MudForm>
<MudButton OnClick="@ToggleOpen" Class="ml-auto mr-n3 mb-1" Color="Color.Error">Close</MudButton>

@ -11,16 +11,16 @@ public partial class TeamListPanel
[Inject]
private ITeamService TeamService { get; init; }
private bool _isOpen;
private MudForm form;
bool success;
string[] errors = { };
private string? FormName { get; set; }
private string? FormPicture { get; set; }
private string? FormMainColor { get; set; }
private string? FormSecondaryColor { get; set; }
private MudForm form;
bool success;
string[] errors = { };
MudTextField<string> pwField1;
private async Task<GridData<Team>> GetTeamsFromServer(GridState<Team> state)
@ -34,16 +34,19 @@ public partial class TeamListPanel
}
private void ToggleOpen()
{
if (_isOpen)
_isOpen = false;
else
_isOpen = true;
_isOpen = !(_isOpen);
}
private async void AddTeam()
{
await TeamService.AddTeam(FormName!,FormPicture!,FormMainColor!,FormSecondaryColor!);
}
private void AddTeamConfirmed()
{
AddTeam();
ToggleOpen();
}
}

Loading…
Cancel
Save