public async Task <IActionResult> GetExchangeRateResult([FromQuery] ExchangeRateInput rateInput) { rateInput.ValidateInputRate(); rateInput.SetMinMaxDate(); var response = await _exchangeRateService.ExchangeRateResponse(rateInput); if (response.IsSuccessStatusCode) { var objectResult = response.Content.ReadAsStringAsync().Result; var rateOutput = JsonConvert.DeserializeObject <ExchangeRateOutput>(objectResult); rateOutput.FilterRateOutput(rateInput.DatesArray); return(Ok(new { rateOutput.MinRate, rateOutput.MaxRate, rateOutput.AvgRate })); } throw new Exception("Internal Service Error"); }