mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-22 09:12:26 +00:00
Add debug option to create new cases in the database
Used until we have a system to create cases when moderation actions are taken
This commit is contained in:
parent
ea25751e71
commit
13f935ffde
6 changed files with 104 additions and 31 deletions
|
@ -0,0 +1,38 @@
|
|||
using System.Diagnostics;
|
||||
using LBPUnion.ProjectLighthouse.Administration;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug;
|
||||
|
||||
public class NewCasePage : BaseLayout
|
||||
{
|
||||
public NewCasePage(Database database) : base(database)
|
||||
{}
|
||||
|
||||
public IActionResult OnGet() => this.Page();
|
||||
|
||||
public async Task<IActionResult> OnPost(
|
||||
int type,
|
||||
string description,
|
||||
DateTime expires,
|
||||
int affectedId
|
||||
)
|
||||
{
|
||||
ModerationCase @case = new()
|
||||
{
|
||||
CaseType = (CaseType)type,
|
||||
CaseDescription = description,
|
||||
CaseExpires = expires,
|
||||
CaseCreated = DateTime.Now,
|
||||
CaseCreatorId = 1,
|
||||
AffectedId = affectedId,
|
||||
};
|
||||
|
||||
this.Database.Cases.Add(@case);
|
||||
await this.Database.SaveChangesAsync();
|
||||
|
||||
return this.Redirect("/moderation/cases/0");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue