Esempio n. 1
0
        public async Task <PagedList <UserView> > ListAsync(UserFilter filter)
        {
            var url = $"{_apiOptions.Users}?{filter?.ToQueryString()}";

            return(await _httpClientService.GetJsonAsync <PagedList <UserView> >(url));
        }
Esempio n. 2
0
        /// <summary>
        /// Search Users using user filter
        /// </summary>
        /// <param name="filter">UserFilter Model</param>
        /// <returns>A user view list object and error info if error occurs</returns>
        public List <UserView> SearchUsers(UserFilter filter, out ApiErrorResponse error)
        {
            var             request   = HttpWebClient.CreateWebRequest("GET", BuildRoute($"user?{filter.ToQueryString()}"));
            var             response  = HttpWebClient.SendWebRequest(request);
            List <UserView> userViews = null;

            error = null;

            if (response != null)
            {
                string result = HttpWebClient.GetResponseBody(response);
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    userViews = result.ToObject <List <UserView> >();
                }
                else
                {
                    error = response.ToErrorResponse();
                }
            }

            return(userViews);
        }