diff --git a/Minecraft-Realms-Emulator/Controllers/WorldsController.cs b/Minecraft-Realms-Emulator/Controllers/WorldsController.cs index 75708cd..12b6c2c 100644 --- a/Minecraft-Realms-Emulator/Controllers/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Controllers/WorldsController.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using Minecraft_Realms_Emulator.Data; using Minecraft_Realms_Emulator.Entities; +using System.Diagnostics.Eventing.Reader; namespace Minecraft_Realms_Emulator.Controllers { @@ -144,5 +145,22 @@ namespace Minecraft_Realms_Emulator.Controllers return Ok(true); } + + [HttpPost("{id}")] + public async Task> UpdateWorld(int id, WorldCreate body) + { + var worlds = await _context.Worlds.ToListAsync(); + + var world = worlds.Find(w => w.Id == id); + + if (world == null) return NotFound("World not found"); + + world.Name = body.Name; + world.Motd = body.Description; + + _context.SaveChanges(); + + return Ok(true); + } } }