forked from HTBox/TwoWeeksReady
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathList.razor
More file actions
55 lines (43 loc) · 1.14 KB
/
Copy pathList.razor
File metadata and controls
55 lines (43 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@page "/HazardHunts/"
@attribute [Authorize(Roles = "admin")]
@inject IRepository Repository
<h1>Administer Hazard Hunt for Two Weeks Ready</h1>
<h3>Current Hazards Defined:</h3>
@if (_HazardHunts != null && _HazardHunts.Any())
{
<table>
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
@foreach (var hazard in _HazardHunts)
{
<tr>
<td>
<a href="/HazardHunts/@hazard.Id">
@hazard.Name
</a>
</td>
</tr>
}
</tbody>
</table>
}
else
{
<p>No Hazards defined.</p>
}
@code {
private IEnumerable<HazardHunt> _HazardHunts { get; set; }
protected override async Task OnInitializedAsync()
{
try {
_HazardHunts = await Repository.GetAllHazardHunts();
} catch (NotImplementedException) {
// Application is still growing, let's not throw an error yet
_HazardHunts = Enumerable.Empty<HazardHunt>();
}
}
}