mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-09 03:52:26 +00:00
Split GameAPI and Website into their own projects
This commit is contained in:
parent
bb03a01246
commit
14154faaf8
116 changed files with 484 additions and 287 deletions
|
@ -0,0 +1,28 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Website.Pages.Admin;
|
||||
|
||||
public class AdminPanelUsersPage : BaseLayout
|
||||
{
|
||||
public int UserCount;
|
||||
|
||||
public List<User> Users = new();
|
||||
public AdminPanelUsersPage(Database database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet()
|
||||
{
|
||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
if (!user.IsAdmin) return this.NotFound();
|
||||
|
||||
this.Users = await this.Database.Users.OrderByDescending(u => u.UserId).ToListAsync();
|
||||
this.UserCount = this.Users.Count;
|
||||
|
||||
return this.Page();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue