parent
992c403b21
commit
03191d5cee
@ -0,0 +1,23 @@
|
||||
@page "/addPlayer"
|
||||
@using Blazor.Models
|
||||
|
||||
<h3>Add Player</h3>
|
||||
|
||||
<EditForm Model="@playerModel" OnValidSubmit="@HandleValidSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
|
||||
<p>
|
||||
<label for="nickname">
|
||||
Nickname:
|
||||
<InputText id="nickname" @bind-Value="playerModel.Nickname" />
|
||||
</label>
|
||||
<label for="hashedPassword">
|
||||
Password:
|
||||
<InputText id="hashedPassword" @bind-Value="playerModel.HashedPassword" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</EditForm>
|
@ -0,0 +1,21 @@
|
||||
@page "/editPlayer/{Id:int}"
|
||||
|
||||
<h3>Edit Player</h3>
|
||||
|
||||
<EditForm Model="@playerModel" OnValidSubmit="@HandleValidSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
|
||||
<p>
|
||||
<label for="nickname">
|
||||
Nickname:
|
||||
<InputText id="nickname" @bind-Value="playerModel.Nickname" />
|
||||
</label>
|
||||
<label for="hashedPassword">
|
||||
Password:
|
||||
<InputText id="hashedPassword" @bind-Value="playerModel.HashedPassword" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</EditForm>
|
@ -0,0 +1,30 @@
|
||||
@page "/players"
|
||||
@using Blazor.ViewClasses;
|
||||
@using Blazorise.DataGrid
|
||||
@using Blazored.Modal;
|
||||
<h3>Joueurs</h3>
|
||||
|
||||
<div>
|
||||
<NavLink class="btn btn-primary" href="addPlayer" Match="NavLinkMatch.All">
|
||||
<i class="fa fa-plus"></i> Ajouter
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<DataGrid TItem="Player"
|
||||
Data="@players"
|
||||
ReadData="@OnReadData"
|
||||
TotalItems="@totalPlayer"
|
||||
PageSize="10"
|
||||
ShowPager
|
||||
Responsive>
|
||||
<DataGridColumn TItem="Player" Field="@nameof(Player.Id)" Caption="#" />
|
||||
<DataGridColumn TItem="Player" Field="@nameof(Player.Nickname)" Caption="Username" />
|
||||
<DataGridColumn TItem="Player" Field="@nameof(Player.Id)" Caption="Action">
|
||||
<DisplayTemplate>
|
||||
<a href="editPlayer/@(context.Id)" class="btn btn-primary"><i class="fa fa-edit"></i> Editer</a>
|
||||
<button type="button" class="btn btn-primary" @onclick="() => OnDelete(context.Id)"><i class="fa fa-trash"></i> Supprimer</button>
|
||||
</DisplayTemplate>
|
||||
</DataGridColumn>
|
||||
</DataGrid>
|
||||
|
||||
<script src="Pages/Players.razor.js"></script>
|
Loading…
Reference in new issue