public async Task <PagedList <UserView> > ListAsync(UserFilter filter) { var url = $"{_apiOptions.Users}?{filter?.ToQueryString()}"; return(await _httpClientService.GetJsonAsync <PagedList <UserView> >(url)); }
/// <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); }