public async Task <double> GetLowestTotal(TrolleyDetail details) { var shopperHistory = 0d; using (HttpClient http = new HttpClient()) { var wxEndpoint = $"{_wxBaseUrl}/{_wxTrolleyCalculatorRoute}?{_wxClientTokenParam}"; var requestBody = JsonConvert.SerializeObject(details); var httpContent = new StringContent(requestBody, Encoding.UTF8, "application/json"); var httpResponse = await http.PostAsync(wxEndpoint, httpContent); var result = httpResponse.Content.ReadAsStringAsync().Result; // check if response status ok etc shopperHistory = JsonConvert.DeserializeObject <double>(result); } return(shopperHistory); }
public async Task <double> Get([FromBody] TrolleyDetail details) { var lowest = await _trolleyService.GetLowestTotal(details); return(lowest); }
public double GetLowestTotal(TrolleyDetail details) { // implement logic to calulate lowest total return(0d); }