Misc.
This commit is contained in:
@@ -22,6 +22,13 @@ namespace pointMaster.Controllers
|
||||
|
||||
vm.points = await context.Points.Include(p => p.Patrulje).Include(p => p.Poster).ToListAsync();
|
||||
|
||||
vm.AllowedToDelete = false;
|
||||
|
||||
if (HttpContext.User.Claims.FirstOrDefault(x => x.Value == Roles.Editor) != null)
|
||||
{
|
||||
vm.AllowedToDelete = true;
|
||||
}
|
||||
|
||||
return View(vm);
|
||||
}
|
||||
|
||||
@@ -172,5 +179,6 @@ namespace pointMaster.Controllers
|
||||
public class PointViewModel
|
||||
{
|
||||
public List<Point> points { get; set; } = null!;
|
||||
public bool AllowedToDelete { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
<th scope="col">Post</th>
|
||||
<th scope="col">Point</th>
|
||||
<th scope="col">Turnout</th>
|
||||
@if (Model.AllowedToDelete) {
|
||||
<th scope="col"></th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -21,7 +23,9 @@
|
||||
<td scope="row">@point.Poster.Name</td>
|
||||
<td scope="row">@point.Points</td>
|
||||
<td scope="row">@point.Turnout</td>
|
||||
@if (Model.AllowedToDelete) {
|
||||
<td scope="row"><a asp-action="DeletePoint" asp-controller="Point" asp-route-id="@point.Id" class="btn btn-danger">Slet point</a></td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<td scope="row" class="align-middle">@round.Description</td>
|
||||
<td scope="row" class="align-middle">@round.Location</td>
|
||||
<td scope="row" class="d-flex justify-content-end">
|
||||
<a asp-action="SletPost" asp-route-id="@round.Id" class="btn btn-danger">Slet runde</a>
|
||||
<a asp-action="SletPost" asp-route-id="@round.Id" class="btn btn-danger">Slet post</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user