예제 #1
0
        /// <summary>
        /// Gets driver standings for all seasons.
        /// </summary>
        /// <returns>Driver Standings info.</returns>
        public async Task <StandingsTable> DriverStandingsBySeason()
        {
            try
            {
                HttpResponseMessage response = await _client.GetAsync(_api.ChampionsByYear());

                if (response.IsSuccessStatusCode)
                {
                    string content = await response.Content.ReadAsStringAsync();

                    return(JsonConvert.DeserializeObject <DataErgastStandings>(DataErgast.RemoveMRData(content))?.StandingsTable);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("\tERROR {0}", ex.Message);
            }
            return(null);
        }