From c4497566e85d63f0cb9ba9bf0b65d22c2b7b8b71 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 17 Oct 2021 01:15:01 -0400 Subject: [PATCH] Fix level uploading --- ProjectLighthouse/Controllers/PublishController.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ProjectLighthouse/Controllers/PublishController.cs b/ProjectLighthouse/Controllers/PublishController.cs index dd1fae0b..f94e4292 100644 --- a/ProjectLighthouse/Controllers/PublishController.cs +++ b/ProjectLighthouse/Controllers/PublishController.cs @@ -25,7 +25,9 @@ namespace ProjectLighthouse.Controllers { Slot slot = await this.GetSlotFromBody(); if(slot == null) return this.BadRequest(); // if the level cant be parsed then it obviously cant be uploaded - return this.Ok(LbpSerializer.TaggedStringElement("slot", "", "type", "user")); + string resource = LbpSerializer.StringElement("resource", slot.Resource); + + return this.Ok(LbpSerializer.TaggedStringElement("slot", resource, "type", "user")); } /// @@ -56,7 +58,9 @@ namespace ProjectLighthouse.Controllers { [HttpPost("unpublish/{id:int}")] public async Task Unpublish(int id) { - Slot slot = await database.Slots.FirstOrDefaultAsync(s => s.SlotId == id); + Slot slot = await database.Slots + .Include(s => s.Location) + .FirstOrDefaultAsync(s => s.SlotId == id); database.Locations.Remove(slot.Location); database.Slots.Remove(slot);