public async Task GetOne() { if (!MainController.Instance.global_parameters.ContainsKey("id")) { Feedback += "Parameter 'id' not found\n"; return; } try { string id = MainController.Instance.global_parameters["id"]; string url = users_path + "/" + id; var response = await _client.GetAsync(url); response.EnsureSuccessStatusCode(); var user = await response.Content.ReadAsAsync<User>(); User = user; UserFound = true; } catch (Newtonsoft.Json.JsonException jEx) { Feedback += jEx.Message + "\n"; } catch (HttpRequestException ex) { Feedback += ex.Message + "\n"; } }
public UsersController(HttpClient client) { _client = client; _user = User.EmptyInstance; _userFound = false; }