diff --git a/pointMaster/Controllers/PointController.cs b/pointMaster/Controllers/PointController.cs index 23403a4..ebeaa07 100644 --- a/pointMaster/Controllers/PointController.cs +++ b/pointMaster/Controllers/PointController.cs @@ -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 points { get; set; } = null!; + public bool AllowedToDelete { get; set; } = false; } } diff --git a/pointMaster/Views/Point/Index.cshtml b/pointMaster/Views/Point/Index.cshtml index 4e5940d..3a1b4b5 100644 --- a/pointMaster/Views/Point/Index.cshtml +++ b/pointMaster/Views/Point/Index.cshtml @@ -10,7 +10,9 @@ Post Point Turnout - + @if (Model.AllowedToDelete) { + + } @@ -21,7 +23,9 @@ @point.Poster.Name @point.Points @point.Turnout - Slet point + @if (Model.AllowedToDelete) { + Slet point + } } diff --git a/pointMaster/Views/Poster/Index.cshtml b/pointMaster/Views/Poster/Index.cshtml index 00643a0..975eef1 100644 --- a/pointMaster/Views/Poster/Index.cshtml +++ b/pointMaster/Views/Poster/Index.cshtml @@ -23,7 +23,7 @@ @round.Description @round.Location - Slet runde + Slet post }