Пример #1
0
        public async Task <ICollection <UserDTO> > Execute(int id, WebRequestHelper helper)
        {
            Query query = queryManager.Get(id);

            if (query == null)
            {
                return(null);
            }
            ICollection <UserDTO> users;
            HttpResponseMessage   httpResponseMessage = await httpClient.GetAsync(helper.CreateRequest(mapper.Map <QueryDisplayDTO>(query)));

            if (httpResponseMessage.IsSuccessStatusCode)
            {
                users = await httpResponseMessage.Content.ReadAsAsync <ICollection <UserDTO> >();

                var entities = mapper.Map <IEnumerable <User> >(users);
                query = queryManager.SetExecuted(query);
                userManager.Add(query, entities.ToArray());
                return(users);
            }
            return(null);
        }