public async Task <IEnumerable <OddViewModel> > FetchAllTennisOdds(DateTime date) { var oddsViewModels = new List <OddViewModel>(); var missingAlias = new List <MissingTeamPlayerAliasObject>(); var tournaments = DaysTournaments(date, this.sport); var oddsSources = this.bookmakerRepository .GetActiveOddsSources() .ToList(); //check URL's exist first var urlCheck = tournaments.SelectMany(t => oddsSources.Where(s => this.bookmakerRepository.GetTournamentCouponUrl(t, s) == null) .Select(s => new MissingTournamentCouponURLObject() { ExternalSource = s.Source, Tournament = t.TournamentName })) .ToList(); if (urlCheck.Count() > 0) { throw new MissingTournamentCouponURLException(urlCheck.ToList(), "Tournament coupons missing"); } foreach (var tournament in tournaments) { foreach (var source in oddsSources) { try { var tournamentViewModel = new TournamentViewModel { TournamentName = tournament.TournamentName, TournamentID = tournament.Id }; var oddsSourceViewModel = new OddsSourceViewModel { Source = source.Source, SourceID = source.Id }; oddsViewModels.AddRange(await FetchTennisOddsForTournamentSource(date, tournamentViewModel, oddsSourceViewModel)); } catch (MissingTeamPlayerAliasException mtpaEx) { missingAlias.AddRange(mtpaEx.MissingAlias); } } } if (missingAlias.Count > 0) { throw new MissingTeamPlayerAliasException(missingAlias, "Missing team or player alias"); } return(oddsViewModels); }
public async Task <IEnumerable <OddViewModel> > FetchAllFootballOdds(DateTime date) { var odds = new List <OddViewModel>(); var tournaments = DaysTournaments(date, this.sport).ToList(); var oddsSources = this.bookmakerRepository.GetActiveOddsSources().ToList(); foreach (var tournament in tournaments) { foreach (var source in oddsSources) { var tournamentViewModel = new TournamentViewModel { TournamentName = tournament.TournamentName }; var oddsSourceViewModel = new OddsSourceViewModel { Source = source.Source }; odds.AddRange(await FetchFootballOddsForTournamentSource(date, tournamentViewModel, oddsSourceViewModel)); } } return(odds); }
public async Task <IEnumerable <OddViewModel> > FetchTennisOddsForTournamentSource(DateTime date, TournamentViewModel tournament, OddsSourceViewModel oddsSource) { var urlCheck = this.bookmakerRepository .GetTournamentCouponUrl(tournament.TournamentName, oddsSource.Source); if (urlCheck == null) { //will have already been checked for the FetchAllTennisOddsVersion var missingURL = new MissingTournamentCouponURLObject { ExternalSource = oddsSource.Source, ExternalSourceID = oddsSource.SourceID, Tournament = tournament.TournamentName, TournamentID = tournament.TournamentID }; throw new MissingTournamentCouponURLException(new MissingTournamentCouponURLObject[] { missingURL }, "Tournament coupons missing"); } return(await FetchCoupons(date, tournament.TournamentName, oddsSource.Source)); }
public async Task<IEnumerable<OddViewModel>> FetchAllTennisOdds(DateTime date) { var oddsViewModels = new List<OddViewModel>(); var missingAlias = new List<MissingTeamPlayerAliasObject>(); var tournaments = DaysTournaments(date, this.sport); var oddsSources = this.bookmakerRepository .GetActiveOddsSources() .ToList(); //check URL's exist first var urlCheck = tournaments.SelectMany(t => oddsSources.Where(s => this.bookmakerRepository.GetTournamentCouponUrl(t, s) == null) .Select(s => new MissingTournamentCouponURLObject() { ExternalSource = s.Source, Tournament = t.TournamentName })) .ToList(); if (urlCheck.Count() > 0) throw new MissingTournamentCouponURLException(urlCheck.ToList(), "Tournament coupons missing"); foreach (var tournament in tournaments) { foreach (var source in oddsSources) { try { var tournamentViewModel = new TournamentViewModel { TournamentName = tournament.TournamentName, TournamentID = tournament.Id }; var oddsSourceViewModel = new OddsSourceViewModel { Source = source.Source, SourceID = source.Id }; oddsViewModels.AddRange(await FetchTennisOddsForTournamentSource(date, tournamentViewModel, oddsSourceViewModel)); } catch (MissingTeamPlayerAliasException mtpaEx) { missingAlias.AddRange(mtpaEx.MissingAlias); } } } if (missingAlias.Count > 0) throw new MissingTeamPlayerAliasException(missingAlias, "Missing team or player alias"); return oddsViewModels; }
public async Task<IEnumerable<OddViewModel>> FetchTennisOddsForTournamentSource(DateTime date, TournamentViewModel tournament, OddsSourceViewModel oddsSource) { var urlCheck = this.bookmakerRepository .GetTournamentCouponUrl(tournament.TournamentName, oddsSource.Source); if (urlCheck == null) { //will have already been checked for the FetchAllTennisOddsVersion var missingURL = new MissingTournamentCouponURLObject { ExternalSource = oddsSource.Source, ExternalSourceID = oddsSource.SourceID, Tournament = tournament.TournamentName, TournamentID = tournament.TournamentID }; throw new MissingTournamentCouponURLException(new MissingTournamentCouponURLObject[] { missingURL }, "Tournament coupons missing"); } return await FetchCoupons(date, tournament.TournamentName, oddsSource.Source); }
public IEnumerable<OddViewModel> FetchAllFootballOdds(DateTime date) { var odds = new List<OddViewModel>(); var tournaments = DaysTournaments(date, this.sport).ToList(); var oddsSources = this.bookmakerRepository.GetActiveOddsSources().ToList(); foreach (var tournament in tournaments) { foreach (var source in oddsSources) { var tournamentViewModel = new TournamentViewModel { TournamentName = tournament.TournamentName }; var oddsSourceViewModel = new OddsSourceViewModel { Source = source.Source }; odds.AddRange(FetchFootballOddsForTournamentSource(date, tournamentViewModel, oddsSourceViewModel)); } } return odds; }
public IEnumerable<OddViewModel> FetchFootballOddsForTournamentSource( DateTime date, TournamentViewModel tournament, OddsSourceViewModel oddsSource) { return FetchCoupons(date, tournament.TournamentName, oddsSource.Source, this.sport, true, false); }
public async Task <IEnumerable <OddViewModel> > FetchFootballOddsForTournamentSource( DateTime date, TournamentViewModel tournament, OddsSourceViewModel oddsSource) { return(await FetchCoupons(date, tournament.TournamentName, oddsSource.Source)); }
public async Task<IEnumerable<OddViewModel>> FetchFootballOddsForTournamentSource( DateTime date, TournamentViewModel tournament, OddsSourceViewModel oddsSource) { return await FetchCoupons(date, tournament.TournamentName, oddsSource.Source); }
public IEnumerable <OddViewModel> FetchFootballOddsForTournamentSource( DateTime date, TournamentViewModel tournament, OddsSourceViewModel oddsSource) { return(FetchCoupons(date, tournament.TournamentName, oddsSource.Source, this.sport, true, false)); }