public async Task <CalculateIncomeTaxResponse> GetIncomeTaxEstimate(CalculateIncomeTaxDto request) { var json = JsonConvert.SerializeObject(request, new JsonSerializerSettings { ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() } }); using var payload = new StringContent( json, Encoding.UTF8, "application/json" ); using var res = await httpClient.PostAsync($"calculate/{request.Year}", payload); var resStream = await res.Content.ReadAsStringAsync(); var content = JsonConvert.DeserializeObject <CalculateIncomeTaxResponse>(resStream, new JsonSerializerSettings { ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() } }); if (content == null) { throw new NullReferenceException(nameof(content)); } return(content); }
public async Task <ActionResult <CalculateIncomeTaxResponse> > GetIncomeTaxEstimate([FromBody] CalculateIncomeTaxDto request) { var result = await taxeeService.GetIncomeTaxEstimate(request); return(Ok(result)); }