Пример #1
0
 public static void Execute(string username, NewGameData newGameData)
 {
     using (var context = new MonopolyDotNetDbContext())
       {
     var game = new Game(newGameData, username);
     context.Games.Add(game);
     context.SaveChanges();
       }
 }
Пример #2
0
 public static void Execute(Game game)
 {
     using (var context = new MonopolyDotNetDbContext())
       {
     context.Games.Attach(game);
     game.BuyProperty();
     context.SaveChanges();
       }
 }
 public static Game Execute(string username)
 {
     using (var context = new MonopolyDotNetDbContext())
       {
     return context.Games
       .AsQueryable()
       .Include(x=>x.Players)
       .Include(x=>x.Players.Select(y=>y.Holdings))
       .Include(x => x.Players.Select(y => y.Location))
       .Include(x => x.Players.Select(y => y.Location.Property))
       .Single(x => x.Username == username);
       }
 }