private Game CreateNewGame(NflDotComGame nflDotComGame, Dictionary<string, Team> teamsDictionary) { var game = new Game { AwayTeamScore = nflDotComGame.AwayScore, GameTime = nflDotComGame.DateTime, HomeTeamScore = nflDotComGame.HomeScore, IsGameOver = nflDotComGame.IsFinal, Season = nflDotComGame.Season, Week = nflDotComGame.WeekNumber }; if (nflDotComGame.AwayTeam != null && !String.IsNullOrWhiteSpace(nflDotComGame.AwayTeam.Abbreviation)) { Team sportPicksTeam; if (teamsDictionary.TryGetValue(nflDotComGame.AwayTeam.Abbreviation.ToUpper(), out sportPicksTeam)) { game.AwayTeam = sportPicksTeam; } } if (nflDotComGame.HomeTeam != null && !String.IsNullOrWhiteSpace(nflDotComGame.HomeTeam.Abbreviation)) { Team sportPicksTeam; if (teamsDictionary.TryGetValue(nflDotComGame.HomeTeam.Abbreviation.ToUpper(), out sportPicksTeam)) { game.HomeTeam = sportPicksTeam; } } if (nflDotComGame.Winner != null && !String.IsNullOrWhiteSpace(nflDotComGame.Winner.Abbreviation)) { Team sportPicksTeam; if (teamsDictionary.TryGetValue(nflDotComGame.Winner.Abbreviation.ToUpper(), out sportPicksTeam)) { game.WinningTeamId = sportPicksTeam.Id; } } return game; }
private static bool IsGameMatchingBySeasonWeekAndParticipants(Game game, NflDotComGame nflDotComGame) { return game.Season == nflDotComGame.Season && game.Week == nflDotComGame.WeekNumber && game.HomeTeam.Abbreviation.ToUpper() == nflDotComGame.HomeTeam.Abbreviation.ToUpper() && game.AwayTeam.Abbreviation.ToUpper() == nflDotComGame.AwayTeam.Abbreviation.ToUpper(); }