Esempio n. 1
0
        public async Task <TeamsContainer> GetAllLagueTeams(int id)
        {
            string json = "";

            using WebClient client = new WebClient();
            json = await client.DownloadStringTaskAsync($@"https://www.thesportsdb.com/api/v1/json/1/lookup_all_teams.php?id={id}").ConfigureAwait(true);

            TeamsContainer container = Newtonsoft.Json.JsonConvert.DeserializeObject <TeamsContainer>(json);

            if (container == null)
            {
                return(null);
            }
            return(container);
        }
Esempio n. 2
0
        public async Task <Team> GetTeamDetails(int id)
        {
            string json = "";

            using WebClient client = new WebClient();
            string apiKey = "2ab3d4cc504e93fa2849ead5596dbbea36f7f4e6f0f2bc6e4899fd1dfda3b24d";

            json = await client.DownloadStringTaskAsync($@"https://www.thesportsdb.com/api/v1/json/1/lookupteam.php?id={id}").ConfigureAwait(true);

            TeamsContainer container = Newtonsoft.Json.JsonConvert.DeserializeObject <TeamsContainer>(json);

            if (container.teams is null)
            {
                return(null);
            }
            return(container.teams[0]);
        }