diff --git a/ProjectLighthouse.Servers.Website/Pages/CasePage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/CasePage.cshtml.cs index e5457a3e..64889ea5 100644 --- a/ProjectLighthouse.Servers.Website/Pages/CasePage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/CasePage.cshtml.cs @@ -23,13 +23,25 @@ public class CasePage : BaseLayout { CaseId = 1, CaseCreated = DateTime.Now, - CaseExpires = new DateTime(2023, 11, 17), + CaseExpires = new DateTime(2011, 11, 17), CaseCreatorId = user.UserId, CaseCreator = user, CaseDescription = "Being a dumbass", CaseType = CaseType.UserBan, AffectedId = user.UserId, }); + + this.Cases.Add(new ModerationCase + { + CaseId = 2, + CaseCreated = DateTime.Now, + CaseExpires = new DateTime(2023, 11, 17), + CaseCreatorId = user.UserId, + CaseCreator = user, + CaseDescription = "Being too cool", + CaseType = CaseType.UserSilence, + AffectedId = user.UserId, + }); return this.Page(); } diff --git a/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml b/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml index 9915aa06..ef10e9d7 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml @@ -7,18 +7,33 @@ @{ Database database = new(); + string color = Model.Expired ? "red" : "yellow"; } -
+

Case #@Model.CaseId: @Model.CaseType

-

Created by @Model.CaseCreator?.Username

-

Description: @Model.CaseDescription

+ @if (Model.Expired) + { +

+ This case expired on @Model.CaseExpires!.Value.ToString("MM/dd/yyyy @ h:mm tt"). +

+ } + + + Case created by @Model.CaseCreator.Username + on @Model.CaseCreated.ToString("MM/dd/yyyy @ h:mm tt") +
+ + + Description: @Model.CaseDescription +
+ @if (Model.CaseType.AffectsLevel()) { Slot slot = await Model.GetSlotAsync(database);

Affected level: @slot.Name

} - @if (Model.CaseType.AffectsUser()) + else if (Model.CaseType.AffectsUser()) { User user = await Model.GetUserAsync(database);

Affected user: @user.Username

diff --git a/ProjectLighthouse/Administration/ModerationCase.cs b/ProjectLighthouse/Administration/ModerationCase.cs index 6d4b6760..45deac03 100644 --- a/ProjectLighthouse/Administration/ModerationCase.cs +++ b/ProjectLighthouse/Administration/ModerationCase.cs @@ -22,6 +22,7 @@ public class ModerationCase public DateTime CaseCreated { get; set; } public DateTime? CaseExpires { get; set; } + public bool Expired => this.CaseExpires != null && this.CaseExpires < DateTime.Now; public int CaseCreatorId { get; set; }