/// <summary> /// Get all races in a year. /// </summary> /// <param name="year">Year of the season.</param> /// <returns>All races in a year.</returns> public async Task <RaceTable> GetRacesBySeasonAsync(int year) { try { HttpResponseMessage response = await _client.GetAsync(_api.RacesBySeason(year)); 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); }