예제 #1
0
        public async Task <LstCountryDTO> GetLstCountry(string text)
        {
            LstCountryDTO output       = new LstCountryDTO();
            string        apiUrl       = $"/api/v1/Country/GetLstCountry";
            string        paramRequest = $"?keyword={text}";
            var           response     = await _client.GetAsync(apiUrl + paramRequest);

            if (response.IsSuccessStatusCode)
            {
                string responseStream = await response.Content.ReadAsStringAsync();

                output = JsonConvert.DeserializeObject <LstCountryDTO>(responseStream);
            }
            return(output);
        }
예제 #2
0
        public async Task <LstCountryDTO> GetLstCountry(string keyword)
        {
            var output = new LstCountryDTO();

            try
            {
                var result = await _repoWrapper.Country.GetListCountry(keyword);

                output.data = _mapper.Map <List <CountryDTO> >(result);
            }
            catch (Exception ex)
            {
                _logger.LogError($"GetLstCountry: " + ex.ToString());
            }
            return(output);
        }