public BinlistResponseViewModel()

        {
            responsemodels = new BinlistResponseModel();
            requestModels  = new BinlistRequestModel();
            service        = new BinlistWebApiService();
        }
Esempio n. 2
0
        private async Task <BinlistResponseModel> CallBinlistNet(string cardIin)
        {
            BinlistResponseModel apirResult = new BinlistResponseModel();

            var binlistBaseUrl = _configuration["BinlistBaseUrl"];

            var client = new RestClient($"{binlistBaseUrl}/{cardIin}");

            var request = new RestRequest(Method.GET);

            try
            {
                IRestResponse <BinlistResponseModel> response = await client.ExecuteAsync <BinlistResponseModel>(request);

                _logger.LogInformation($"[BinlistService][GetBinlist][ApiResponse] {response.Content}");

                apirResult = JsonConvert.DeserializeObject <BinlistResponseModel>(response.Content);
            }
            catch (Exception ex)
            {
                _logger.LogError($"[BinlistService][GetBinlist] An error occured while making request {ex.Message} {ex.InnerException}");
            }

            return(apirResult);
        }