Exemplo n.º 1
0
        /// <summary>
        /// Gets all drivers who has won at least once in this circuit.
        /// </summary>
        /// <param name="circuit">Circuit ID.</param>
        /// <returns>Drivers info.</returns>
        public async Task <DriverTable> GetDriversWinnerCircuitAsync(string circuit)
        {
            try
            {
                HttpResponseMessage response = await _client.GetAsync(_api.DriversWinnersInCircuit(circuit));

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

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