mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-14 22:02:26 +00:00
38 lines
No EOL
1,017 B
C#
38 lines
No EOL
1,017 B
C#
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()
|
|
{
|
|
Type = (CaseType)type,
|
|
Reason = description,
|
|
ExpiresAt = expires,
|
|
CreatedAt = DateTime.Now,
|
|
CreatorId = 1,
|
|
AffectedId = affectedId,
|
|
};
|
|
|
|
this.Database.Cases.Add(@case);
|
|
await this.Database.SaveChangesAsync();
|
|
|
|
return this.Redirect("/moderation/cases/0");
|
|
}
|
|
} |