/// <summary> /// Gets all races that a Driver has been into. /// </summary> /// <param name="driver">Driver ID.</param> /// <returns>Race list info.</returns> public async Task <RaceTable> RacesByDriverAsync(string driver) { try { HttpResponseMessage response = await _client.GetAsync(_api.RacesByDriver(driver)); if (response.IsSuccessStatusCode) { string content = await response.Content.ReadAsStringAsync(); var aux = JsonConvert.DeserializeObject <DataErgastRaces>(DataErgast.RemoveMRData(content)); if (aux != null) { return(aux.RaceTable); } } } catch (Exception ex) { Debug.WriteLine("\tERROR {0}", ex.Message); } return(null); }