Beispiel #1
0
        public async Task <IActionResult> Search(int?id)
        {
            var url   = _appSettings.EmployeeApi + Constants.GetUriEmployeeApi;
            var param = new Dictionary <string, string>()
            {
                { "id", id.HasValue ? id.Value.ToString() : string.Empty }
            };

            var newUrl = new Uri(QueryHelpers.AddQueryString(url, param));

            var employeeList = await _httpClientCustom.GetAsync <IEnumerable <Employee> >(newUrl);

            return(View(employeeList));
        }
Beispiel #2
0
        public async Task <IEnumerable <Employee> > GetEmployees()
        {
            var uri = new Uri(_appSettings.Masglobaltestapi + Constants.GetAllEmployees);

            return(await _httpClientCustom.GetAsync <IEnumerable <Employee> >(uri));
        }