Ejemplo n.º 1
0
        /// <summary>
        /// Gets constructor standings at the end of a race.
        /// </summary>
        /// <param name="year">Year of the race.</param>
        /// <param name="round">Round of the season.</param>
        /// <returns>Constructor standings info.</returns>
        public async Task <StandingsTable> ConstructorStandingsByRace(int year, int round)
        {
            try
            {
                HttpResponseMessage response = await _client.GetAsync(_api.ConstructorStandingsByRace(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);
        }