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 = candidates_path + "/" + id; var response = await _client.GetAsync(url); response.EnsureSuccessStatusCode(); var candidate = await response.Content.ReadAsAsync<Candidate>(); Candidate = candidate; CandidateFound = true; } catch (Newtonsoft.Json.JsonException jEx) { Feedback += jEx.Message + "\n"; } catch (HttpRequestException ex) { Feedback += ex.Message + "\n"; } finally { Feedback += "transaction completed!!"; } }
public CandidatesController(HttpClient client) { _client = client; _candidate = Candidate.EmptyInstance; _candidateFound = false; }