@page "/questions"
@using Blazor.ViewClasses;
@using Blazorise.DataGrid
@using Blazored.Modal;
<h3>Chapters</h3>

<div>
    <NavLink class="btn btn-primary" href="addQuestion" Match="NavLinkMatch.All">
        <i class="fa fa-plus"></i> Ajouter
    </NavLink>
</div>

<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" />

    <DataGridColumn TItem="Question" Field="@nameof(Question.Id)" Caption="Action">
        <DisplayTemplate>
            <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>
        </DisplayTemplate>
    </DataGridColumn>
</DataGrid>