mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-13 05:12:27 +00:00
Refactor Database into DatabaseContext Moved into separate folder so it actually has a namespace instead sitting in the root
31 lines
No EOL
940 B
C#
31 lines
No EOL
940 B
C#
using LBPUnion.ProjectLighthouse.Database;
|
|
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
|
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login;
|
|
|
|
public class PirateSignupPage : BaseLayout
|
|
{
|
|
public PirateSignupPage(DatabaseContext database) : base(database)
|
|
{}
|
|
|
|
public IActionResult OnGet()
|
|
{
|
|
User? user = this.Database.UserFromWebRequest(this.Request);
|
|
if (user == null) return this.Redirect("/login");
|
|
|
|
return this.Page();
|
|
}
|
|
|
|
public async Task<IActionResult> OnPost()
|
|
{
|
|
User? user = this.Database.UserFromWebRequest(this.Request);
|
|
if (user == null) return this.Redirect("/login");
|
|
|
|
user.Language = user.Language == "en-PT" ? "en" : "en-PT";
|
|
await this.Database.SaveChangesAsync();
|
|
|
|
return this.Redirect("/");
|
|
}
|
|
} |