示例#1
0
 public static void DeleteGame(Game game)
 {
     using (var db = new EloDbContext())
     {
         db.Games.Remove(game);
         db.SaveChanges();
     }
 }
示例#2
0
 public static void DeletePlayers(IEnumerable <Player> players)
 {
     using (var db = new EloDbContext())
     {
         db.Players.RemoveRange(players);
         db.SaveChanges();
     }
 }
示例#3
0
 public static void DeleteAllPlayerSeasons()
 {
     using (var db = new EloDbContext())
     {
         db.PlayerSeasons.RemoveRange(db.PlayerSeasons);
         db.SaveChanges();
     }
 }
示例#4
0
 public static void UpdatePlayerSeasons(IEnumerable <PlayerSeason> playerSeasons)
 {
     using (var db = new EloDbContext())
     {
         db.PlayerSeasons.UpdateRange(playerSeasons);
         db.SaveChanges();
     }
 }
示例#5
0
 public static void DeleteRatingsAfter(int ratingId, bool deleteDefaultRatings = true)
 {
     using (var db = new EloDbContext())
     {
         db.Ratings.RemoveRange(db.Ratings.Where(r => r.Id > ratingId && (deleteDefaultRatings || r.GameId != null)));
         db.SaveChanges();
     }
 }
示例#6
0
 public static void AddRatings(IEnumerable <PlayerRating> ratings)
 {
     using (var db = new EloDbContext())
     {
         db.Ratings.AddRange(ratings);
         db.SaveChanges();
     }
 }
示例#7
0
 public static void AddRating(PlayerRating rating)
 {
     using (var db = new EloDbContext())
     {
         db.Ratings.Add(rating);
         db.SaveChanges();
     }
 }
示例#8
0
        public static Season AddSeason(Season season)
        {
            using (var db = new EloDbContext())
            {
                db.Seasons.Add(season);
                db.SaveChanges();
            }

            return(season);
        }
示例#9
0
        public static Game AddGame(Game game)
        {
            using (var db = new EloDbContext())
            {
                db.Games.Add(game);
                db.SaveChanges();
            }

            return(game);
        }
示例#10
0
        public static Player AddPlayer(Player player)
        {
            using (var db = new EloDbContext())
            {
                db.Players.Add(player);
                db.SaveChanges();
            }

            return(player);
        }
示例#11
0
        public static PlayerSeason AddPlayerSeason(PlayerSeason playerSeason)
        {
            using (var db = new EloDbContext())
            {
                db.PlayerSeasons.Add(playerSeason);
                db.SaveChanges();
            }

            return(playerSeason);
        }