Adding Logout, and other misc.

This commit is contained in:
Benjamin
2024-11-18 11:51:19 +01:00
parent d354039be5
commit 26b01e273f
2 changed files with 12 additions and 12 deletions

View File

@@ -19,16 +19,6 @@ namespace pointMaster.Controllers
vm.links = new List<NavUrl>(); vm.links = new List<NavUrl>();
if (User.Identity.IsAuthenticated)
{
vm.links.Add(new NavUrl("Giv point", "/point/givpoint"));
}
else
{
vm.links.Add(new NavUrl("Log ind", "/account/signin"));
}
if (HttpContext.User.Claims.FirstOrDefault(x => x.Value == Roles.Editor) != null) if (HttpContext.User.Claims.FirstOrDefault(x => x.Value == Roles.Editor) != null)
{ {
vm.links.Add(new NavUrl("Patruljer", "/Patrulje")); vm.links.Add(new NavUrl("Patruljer", "/Patrulje"));
@@ -36,6 +26,16 @@ namespace pointMaster.Controllers
vm.links.Add(new NavUrl("Poster", "/Poster")); vm.links.Add(new NavUrl("Poster", "/Poster"));
} }
if (User.Identity.IsAuthenticated)
{
vm.links.Add(new NavUrl("Giv point", "/point/givpoint"));
vm.links.Add(new NavUrl("Log ud", "/account/signout"));
}
else
{
vm.links.Add(new NavUrl("Log ind", "/account/signin"));
}
return View(vm); return View(vm);
} }
} }

View File

@@ -45,7 +45,7 @@ namespace pointMaster.Controllers
} }
[HttpGet] [HttpGet]
public async Task<IActionResult> SletPost(int id) public ActionResult SletPost(int id)
{ {
var post = _context.Poster.Find(id); var post = _context.Poster.Find(id);
@@ -62,7 +62,7 @@ namespace pointMaster.Controllers
public class RundeViewModel public class RundeViewModel
{ {
public List<Post> Rounds { get; set; } public List<Post> Rounds { get; set; } = null!;
} }
} }
} }