public static void DeleteTeamRecordsInWeek(int year, int week) { using (var db = new FFStatsDbContext()) { db.TeamRecords.RemoveRange(db.TeamRecords.Where(tr => tr.Year == year && tr.Week == week)); db.SaveChanges(); } }
public static void Update(SeasonInfo seasonInfo) { using (var db = new FFStatsDbContext()) { db.SeasonInfo.Update(seasonInfo); db.SaveChanges(); } }
public static void Add(TeamRecord teamRecord) { using (var db = new FFStatsDbContext()) { db.TeamRecords.Add(teamRecord); db.SaveChanges(); } }
public static void Add(List <PlayoffProbability> playoffProbs) { using (var db = new FFStatsDbContext()) { db.PlayoffProbabilities.AddRange(playoffProbs); db.SaveChanges(); } }
public static void DeleteGamesInYear(int year) { using (var db = new FFStatsDbContext()) { db.Games.RemoveRange(db.Games.Where(g => g.Year == year)); db.SaveChanges(); } }
public static void DeleteRostersInWeek(int year, int week) { using (var db = new FFStatsDbContext()) { db.RemoveRange(db.RosterEntries.Where(re => re.Year == year && re.Week == week)); db.SaveChanges(); } }
public static void AddGames(List <Game> games) { using (var db = new FFStatsDbContext()) { db.Games.AddRange(games); db.SaveChanges(); } }
public static void DeleteWeek(int year, int week) { using (var db = new FFStatsDbContext()) { db.PlayoffProbabilities.RemoveRange( db.PlayoffProbabilities.Where(pp => pp.Year == year && pp.Week == week)); db.SaveChanges(); } }
public static SeasonInfo Add(SeasonInfo seasonInfo) { using (var db = new FFStatsDbContext()) { db.SeasonInfo.Add(seasonInfo); db.SaveChanges(); } return(seasonInfo); }
public static RosterEntry Add(RosterEntry entry) { using (var db = new FFStatsDbContext()) { db.RosterEntries.Add(entry); db.SaveChanges(); } return(entry); }
public static Game AddGame(Game game) { using (var db = new FFStatsDbContext()) { db.Games.Add(game); db.SaveChanges(); } return(game); }
public static Team Add(Team team) { using (var db = new FFStatsDbContext()) { db.Teams.Add(team); db.SaveChanges(); } return(team); }
public static Player Add(Player player) { using (var db = new FFStatsDbContext()) { db.Players.Add(player); db.SaveChanges(); } return(player); }
public static void UpdatePoints(int year, int week, int teamId, double?points) { using (var db = new FFStatsDbContext()) { db.GameScores .Where(gs => gs.Year == year && gs.Week == week && gs.TeamId == teamId) .First() .Points = points; db.SaveChanges(); } }
public static void Add(List <TeamRecord> teamRecords) { using (var db = new FFStatsDbContext()) { db.TeamRecords.AddRange(teamRecords); // the call to AddRange above will set Team in TeamRecord as added, // but since they already exist in the database we need to detach them foreach (var teamRecord in teamRecords) { if (teamRecord.Team != null) { db.Entry(teamRecord.Team).State = EntityState.Detached; } } db.SaveChanges(); } }
public static void Add(List <RosterEntry> entries) { using (var db = new FFStatsDbContext()) { db.RosterEntries.AddRange(entries); // the call to AddRange above will set Player in RosterEntry as added, // but since they already exist in the database we need to detach them foreach (var entry in entries) { if (entry.Player != null) { db.Entry(entry.Player).State = EntityState.Detached; } } db.SaveChanges(); } }