public ActionResult <Room> Post([FromBody] Room room) { var existing = db.Load(room.Name); if (existing != null) { return(BadRequest("exists")); } room.Owner = "TBD"; db.Save(room.Name, room); return(room); }
public void CreateRoom(string name, string owner) { var existing = _roomDatabase.Load(name); if (existing != null) { throw new Exception("room already exists"); } _roomDatabase.Save(name, new Room() { Name = name, Owner = owner }); }