示例#1
0
        public async Task <TaxaJurosViewModel> GetTaxaJuros()
        {
            var token = await GetToken(new AuthenticateDTO
            {
                User     = _authSettings.ClientsConnections.User,
                Password = _authSettings.ClientsConnections.Password
            });

            var taxa = new TaxaJurosViewModel();

            using (var httpClient = new HttpClient())
            {
                var url = _authSettings.ClientsConnections.RunInDocker ? _authSettings.ClientsConnections.UrlApi1Docker : _authSettings.ClientsConnections.UrlApi1;
                using (var request = new HttpRequestMessage(new HttpMethod("GET"), $"{url}/api/TaxaJuros"))
                {
                    request.Headers.TryAddWithoutValidation("accept", "application/json");
                    request.Headers.TryAddWithoutValidation("Authorization", $"Bearer {token.Token}");

                    var response = await httpClient.SendAsync(request);

                    if (response.IsSuccessStatusCode)
                    {
                        taxa = JsonConvert.DeserializeObject <TaxaJurosViewModel>(response.Content.ReadAsStringAsync().Result);
                    }
                }
            }

            return(taxa);
        }
示例#2
0
        public IActionResult BuscarTaxaJuros()
        {
            var jurosModel = new TaxaJurosViewModel
            {
                Juros = _appSettings.Juros / 100
            };

            return(Ok(jurosModel));
        }