public DungeonComponent Get(int componentId) { using (var db = new DungeonContext()) { var component = db.Components .Single(c => c.DungeonComponentId == componentId); return(component); } }
public int Post([FromBody] DungeonComponent component) { using (var db = new DungeonContext()) { db.Components.Add(component); db.SaveChanges(); return(component.DungeonComponentId); } }
public void Put([FromBody] DungeonComponent component) { using (var db = new DungeonContext()) { var comp = db.Components .Single(c => c.DungeonComponentId == component.DungeonComponentId); comp = component; db.SaveChanges(); } }
public DungeonLevel Get(int dungeonLevelId) { using (var db = new DungeonContext()) { var level = db.Levels .Single(l => l.DungeonLevelId == dungeonLevelId); level.Components = db.Components .Where(c => c.DungeonLevelId == dungeonLevelId) .ToList(); return(level); } }
public void Post([FromBody] DungeonLevel level) { using (var db = new DungeonContext()) { db.Levels.Add(level); db.SaveChanges(); Console.WriteLine($"DungeonLevelId: {level.DungeonLevelId}"); foreach (DungeonComponent c in level.Components) { c.DungeonLevelId = level.DungeonLevelId; } db.Components.AddRange(level.Components); db.SaveChanges(); } }
public LogsController(DungeonContext context) { _context = context; }
public PlayersController(DungeonContext context) { _context = context; }
public SessionsController(DungeonContext context) { _context = context; }
public CharactersController(DungeonContext context) { _context = context; }