feat : page questions
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
987bc11c9b
commit
a1b99f9cb7
@ -1,47 +1,29 @@
|
|||||||
@page "/questions"
|
@page "/questions"
|
||||||
@using Blazor.Data
|
@using Blazor.ViewClasses;
|
||||||
@inject WeatherForecastService ForecastService
|
@using Blazorise.DataGrid
|
||||||
|
@using Blazored.Modal;
|
||||||
|
<h3>Chapters</h3>
|
||||||
|
|
||||||
<PageTitle>Weather forecast</PageTitle>
|
<div>
|
||||||
|
<NavLink class="btn btn-primary" href="addChapter" Match="NavLinkMatch.All">
|
||||||
|
<i class="fa fa-plus"></i> Ajouter
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1>Weather forecast</h1>
|
<DataGrid TItem="Question"
|
||||||
|
Data="@questions"
|
||||||
|
ReadData="@OnReadData"
|
||||||
|
TotalItems="@totalQuestion"
|
||||||
|
PageSize="10"
|
||||||
|
ShowPager
|
||||||
|
Responsive>
|
||||||
|
<DataGridColumn TItem="Question" Field="@nameof(Question.Id)" Caption="#" />
|
||||||
|
<DataGridColumn TItem="Question" Field="@nameof(Question.Content)" Caption="Display content" />
|
||||||
|
|
||||||
<p>This component demonstrates fetching data from a service.</p>
|
<DataGridColumn TItem="Question" Field="@nameof(Question.Id)" Caption="Action">
|
||||||
|
<DisplayTemplate>
|
||||||
@if (forecasts == null)
|
<a href="editQuestion/@(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>
|
||||||
<p><em>Loading...</em></p>
|
</DisplayTemplate>
|
||||||
}
|
</DataGridColumn>
|
||||||
else
|
</DataGrid>
|
||||||
{
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Date</th>
|
|
||||||
<th>Temp. (C)</th>
|
|
||||||
<th>Temp. (F)</th>
|
|
||||||
<th>Summary</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var forecast in forecasts)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>@forecast.Date.ToShortDateString()</td>
|
|
||||||
<td>@forecast.TemperatureC</td>
|
|
||||||
<td>@forecast.TemperatureF</td>
|
|
||||||
<td>@forecast.Summary</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private WeatherForecast[]? forecasts;
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue