Пример #1
0
        public async Task <List <EmployeeDTO> > GetAllAsync()
        {
            try
            {
                HelperAPI           api             = new HelperAPI();
                List <EmployeeDTO>  employeesResult = new List <EmployeeDTO>();
                HttpClient          client          = api.Initial();
                HttpResponseMessage response        = await client.GetAsync("/api/Employees");

                if (response.IsSuccessStatusCode)
                {
                    var results = response.Content.ReadAsStringAsync().Result;
                    employeesResult = JsonConvert.DeserializeObject <List <EmployeeDTO> >(results);
                }
                return(employeesResult);
            }
            catch (Exception ex)
            {
                throw;
            }
        }