Example #1
0
        /// <summary>
        /// Gets driver standings at the end of the race.
        /// </summary>
        /// <param name="year">Year of the race.</param>
        /// <param name="round">Round of the season.</param>
        /// <returns>Driver standings info.</returns>
        public async Task <StandingsTable> DriverStandingsByRace(int year, int round)
        {
            try
            {
                HttpResponseMessage response = await _client.GetAsync(_api.DriverStandingsByRace(year, round));

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

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