ajout d'un premier test pour l'affichage des jeux
All checks were successful
All checks were successful
This commit was merged in pull request #23.
This commit is contained in:
10
src/LudikZoneBlazor/Components/Games/GameIcon.razor
Normal file
10
src/LudikZoneBlazor/Components/Games/GameIcon.razor
Normal file
@@ -0,0 +1,10 @@
|
||||
@using LudikZone.model
|
||||
|
||||
<MudPaper Height="140px" Width="140px">
|
||||
@Game.Name
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public required Game Game { get; set; }
|
||||
}
|
||||
@@ -1,28 +1,31 @@
|
||||
@page "/games"
|
||||
|
||||
@using LudikZoneBlazor.Components.Games
|
||||
@using LudikZoneBlazor.Data
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
|
||||
@using LudikZoneBlazor.Data.Model
|
||||
|
||||
@attribute [Authorize]
|
||||
@using LudikZone.model
|
||||
|
||||
@inject IStringLocalizer<Games> localizer
|
||||
@inject ApplicationDbContext context
|
||||
|
||||
<PageTitle>@localizer["Games"]</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3" GutterBottom="true">@localizer["Game list"]</MudText>
|
||||
|
||||
<AuthorizeView>
|
||||
<MudGrid Spacing="10" Justify="Justify.Center">
|
||||
@foreach (var g in GetGames())
|
||||
{
|
||||
|
||||
<MudItem>
|
||||
<GameIcon Game=@g />
|
||||
</MudItem>
|
||||
}
|
||||
</AuthorizeView>
|
||||
</MudGrid>
|
||||
|
||||
@code {
|
||||
|
||||
private List<Game> GetGames()
|
||||
{
|
||||
return new List<Game>();
|
||||
return context.Games.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user