예제 #1
0
 public DungeonComponent Get(int componentId)
 {
     using (var db = new DungeonContext())
     {
         var component = db.Components
                         .Single(c => c.DungeonComponentId == componentId);
         return(component);
     }
 }
예제 #2
0
 public int Post([FromBody] DungeonComponent component)
 {
     using (var db = new DungeonContext())
     {
         db.Components.Add(component);
         db.SaveChanges();
         return(component.DungeonComponentId);
     }
 }
예제 #3
0
 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();
     }
 }
예제 #6
0
 public LogsController(DungeonContext context)
 {
     _context = context;
 }
예제 #7
0
 public PlayersController(DungeonContext context)
 {
     _context = context;
 }
예제 #8
0
 public SessionsController(DungeonContext context)
 {
     _context = context;
 }
예제 #9
0
 public CharactersController(DungeonContext context)
 {
     _context = context;
 }