mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-12 12:52:28 +00:00
Properly organize mod panel related pages
This commit is contained in:
parent
e962c2dee4
commit
5b1342c29d
10 changed files with 10 additions and 13 deletions
|
@ -0,0 +1,37 @@
|
|||
using LBPUnion.ProjectLighthouse.Administration;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
||||
|
||||
public class ModPanelPage : BaseLayout
|
||||
{
|
||||
public ModPanelPage(Database database) : base(database)
|
||||
{}
|
||||
|
||||
public List<AdminPanelStatistic> Statistics = new();
|
||||
|
||||
public async Task<IActionResult> OnGet()
|
||||
{
|
||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
if (!user.IsModerator) return this.NotFound();
|
||||
|
||||
this.Statistics.Add(new AdminPanelStatistic(
|
||||
statisticNamePlural: "Reports",
|
||||
count: await StatisticsHelper.ReportCount(),
|
||||
viewAllEndpoint: "/moderation/reports/0")
|
||||
);
|
||||
|
||||
this.Statistics.Add(new AdminPanelStatistic(
|
||||
statisticNamePlural: "Cases",
|
||||
count: await StatisticsHelper.DismissedCaseCount(),
|
||||
viewAllEndpoint: "/moderation/cases/0",
|
||||
secondStatistic: await StatisticsHelper.CaseCount())
|
||||
);
|
||||
|
||||
return this.Page();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue