Powers.razor 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. @page "/pouvoir-list"
  2. @using DataLayer.Interfaces
  3. @using Domain.XML_Model
  4. @attribute [StreamRendering(true)]
  5. <div>
  6. <h3>Pouvoir</h3>
  7. </div>
  8. <div>
  9. @if (Pouvoirs == null)
  10. {
  11. <p><em>Loading...</em></p>
  12. }
  13. else
  14. {
  15. <table class="table table-striped">
  16. <thead>
  17. <tr>
  18. <th>Nom</th>
  19. <th>Discipline</th>
  20. <th>Seuil</th>
  21. <th>Action</th>
  22. <th>Opposé</th>
  23. <th>Portée</th>
  24. <th>Prolongeable</th>
  25. <th>Description</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. @foreach (var pouvoir in Pouvoirs)
  30. {
  31. <tr>
  32. <td>@pouvoir.Nom</td>
  33. <td>@pouvoir.Discipline</td>
  34. <td>@pouvoir.Seuil</td>
  35. <td>@pouvoir.Action</td>
  36. <td>@pouvoir.Opposé</td>
  37. <td>@pouvoir.Portée</td>
  38. <td>@pouvoir.Prolongeable</td>
  39. <td>@pouvoir.Description</td>
  40. </tr>
  41. }
  42. </tbody>
  43. </table>
  44. }
  45. </div>
  46. @code {
  47. private List<Pouvoir> Pouvoirs { get; set; }
  48. [Inject]
  49. public IAbstractRepository<Pouvoir> _pouvoirRepository { get; set; }
  50. protected override async Task OnInitializedAsync()
  51. {
  52. // Load the pouvoirs data here
  53. Pouvoirs = await LoadPouvoirsAsync();
  54. }
  55. private async Task<List<Pouvoir>> LoadPouvoirsAsync()
  56. {
  57. // Implement the logic to load pouvoirs data
  58. var powers = await _pouvoirRepository.GetAll();
  59. return powers.OrderBy(p => p.Nom).ToList();
  60. }
  61. }