mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-11-24 15:18:20 -05:00
feat: POST /worlds/{id}
This commit is contained in:
parent
b84ddbceee
commit
400187a022
@ -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<ActionResult<bool>> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user