private async Task <string> DisplayQueryLga(int lgaId) { if (lgaId == 0) { return("All Lgas"); } LgaModel lga = await RetrieveLocationById(lgaId); return(lga.Name); }
public static async Task <LgaModel> RetrieveLocationById(int id) { LgaModel result = new LgaModel(); using (var httpClientHandler = new HttpClientHandler()) { httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return(true); }; using (var httpClient = new HttpClient(httpClientHandler)) { using (var response = await httpClient.GetAsync(basUrl + "Location/" + id)) { string apiResponse = await response.Content.ReadAsStringAsync(); result = JsonConvert.DeserializeObject <LgaModel>(apiResponse); } } } return(result); }