mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-06-04 15:12:28 +00:00
Add banned users and hidden levels page to mod panel
This commit is contained in:
parent
4be8efc244
commit
67bad4fd1e
8 changed files with 178 additions and 3 deletions
|
@ -0,0 +1,41 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Levels;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
||||
|
||||
public class HiddenLevelsPage : BaseLayout
|
||||
{
|
||||
public HiddenLevelsPage(Database database) : base(database)
|
||||
{}
|
||||
|
||||
public int PageAmount;
|
||||
|
||||
public int PageNumber;
|
||||
|
||||
public int SlotCount;
|
||||
|
||||
public List<Slot> Slots = new();
|
||||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||
{
|
||||
WebToken? token = this.Database.WebTokenFromRequest(this.Request);
|
||||
if (token == null) return this.Redirect("/login");
|
||||
|
||||
this.Slots = await this.Database.Slots
|
||||
.Where(s => s.Hidden)
|
||||
.Skip(pageNumber * ServerStatics.PageSize)
|
||||
.Take(ServerStatics.PageSize)
|
||||
.ToListAsync();
|
||||
|
||||
this.SlotCount = await this.Database.Slots.CountAsync(s => s.Hidden);
|
||||
|
||||
this.PageAmount = Math.Max(1, (int)Math.Ceiling((double)this.SlotCount / ServerStatics.PageSize));
|
||||
|
||||
return this.Page();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue