private async Task <JsonTournamentMain> GetTournamentsAsync() { DownloadTask downloadTask; try { downloadTask = new DownloadTask("http://www.oddstorm.com/feeds_api/", "POST"); downloadTask.SetPostParams("{\"prematch\": " + this.prematch + ",\"inplay\": " + this.inplay + " }"); } catch { return(null); } string result = String.Empty; result = await Execute(downloadTask, result); if (result == String.Empty) { return(null); } return(JsonConvert.DeserializeObject <JsonTournamentMain>(result)); }
private async Task <JsonEventMain> GetEventsAsync(JsonLeagueMain leagues) { if (leagues == null || leagues.data.Count <= 0) { return(null); } List <int> leaguesIds = new List <int>(); foreach (JsonLeague league in leagues.data) { leagueList.Add(new League(league.id, league.name, league.tournament_id)); leaguesIds.Add(league.id); } string ids = string.Join(",", leaguesIds); DownloadTask downloadTask; try { downloadTask = new DownloadTask("http://www.oddstorm.com/feeds_api/", "POST"); downloadTask.SetPostParams("{\"prematch\": " + this.prematch + ",\"inplay\": " + this.inplay + ", \"scope\": \"matches\", \"league_ids\": [" + ids + "] }"); } catch { return(null); } string result = String.Empty; result = await Execute(downloadTask, result); if (result == String.Empty) { return(null); } //var result = downloadTask.Response; return(JsonConvert.DeserializeObject <JsonEventMain>(result)); }
private async Task <JsonLeagueMain> GetLeaguesAsync(JsonTournamentMain tournamentsResult) { if (tournamentsResult == null || tournamentsResult.data.Count <= 0) { return(null); } List <int> tournamentIds = new List <int>(tournamentsResult.data.Count); foreach (JsonTournament tournament in tournamentsResult.data) { tournamentList.Add(new Tournament(tournament.id, tournament.name, tournament.inplay_leagues_cnt)); tournamentIds.Add(tournament.id); } string ids = string.Join(",", tournamentIds); DownloadTask downloadTask; try { downloadTask = new DownloadTask("http://www.oddstorm.com/feeds_api/", "POST"); downloadTask.SetPostParams("{\"prematch\": " + this.prematch + ",\"inplay\": " + this.inplay + ", \"scope\": \"leagues\", \"tournament_ids\": [" + ids + "] }"); } catch { return(null); } string result = String.Empty; result = await Execute(downloadTask, result); if (result == String.Empty) { return(null); } return(JsonConvert.DeserializeObject <JsonLeagueMain>(result)); }