Beispiel #1
0
        /// <summary>
        /// Gets all races starting by the offset.
        /// </summary>
        /// <param name="offset">Offset to begin counting.</param>
        /// <returns>All races starting in the offset.</returns>
        private async Task <RaceTable> GetRacesByURIAsync(int offset)
        {
            try
            {
                HttpResponseMessage response = await _client.GetAsync(_api.Races(offset));

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

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

            return(null);
        }