public async Task <CustomerResponse> LoadCustomerAsync(int customerId) { var httpRequest = new HttpRequestMessage(HttpMethod.Get, string.Format("/api/customers/{0}", customerId)); var response = await client.SendAsync(httpRequest); var responseContent = await response.Content.ReadAsStringAsync(); return(DataDeserializer.Deserialize <CustomerResponse>(responseContent)); }
public static async Task <CustomerResponse> GetCustomerById(int id) { var client = new HttpClient() { BaseAddress = new Uri("https://failover-api/endpoint/data") }; var httpRequest = new HttpRequestMessage(HttpMethod.Get, string.Format("/customers/{0}", id)); var response = await client.SendAsync(httpRequest); var responseContent = await response.Content.ReadAsStringAsync(); return(DataDeserializer.Deserialize <CustomerResponse>(responseContent)); }