From edaf82c25713299d844c247f1173be0d24af631c Mon Sep 17 00:00:00 2001 From: jvyden Date: Fri, 29 Oct 2021 16:21:23 -0400 Subject: [PATCH] Show used slots --- ProjectLighthouse/Types/User.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 2d77f692..4f06deed 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; using LBPUnion.ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Types.Profiles; using LBPUnion.ProjectLighthouse.Types.Settings; @@ -50,8 +51,14 @@ namespace LBPUnion.ProjectLighthouse.Types { /// /// The number of used slots on the earth /// - public int UsedSlots { get; set; } - + [NotMapped] + public int UsedSlots { + get { + using Database database = new(); + return database.Slots.Count(s => s.CreatorId == this.UserId); + } + } + /// /// The number of slots remaining on the earth ///