public async Task ChangeAlertStatus(string id, AlertManagerViewModel alertContext) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:5000/"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); try { HttpResponseMessage responseMessage = await client.GetAsync($"api/patientsmonitoring/disable/{id}"); if (responseMessage.IsSuccessStatusCode) { MessageBox.Show("Alerts Status is Changed"); //await GetAlerts(alertContext); } else { MessageBox.Show("ID may be wrong, Please check if the alert is still there."); //await GetAlerts(alertContext); } } catch { MessageBox.Show("Error in Connection"); } }
public async Task GetAlerts(AlertManagerViewModel alertContext) { icuID = alertContext.ICUID; //string icuID = "ICU001"; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:5000/"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); try { HttpResponseMessage responseMessage = await client.GetAsync($"api/patientsmonitoring/{icuID}"); if (responseMessage.IsSuccessStatusCode) { var jsonContent = responseMessage.Content.ReadAsStringAsync().Result; alertContext.ListOfAlerts = JsonConvert.DeserializeObject <List <Alert> >(jsonContent); } else { MessageBox.Show("No Alerts. \nIf it is wrong message then call Philips"); } } catch { MessageBox.Show("Error in Connection"); } }
public async Task ChangeAlertStatus(string id, AlertManagerViewModel alertContext) { string icuID = alertContext.ICUID; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("https://localhost:5001/"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage responseMessage = await client.GetAsync($"api/patientsmonitoring/{icuID}/{id}"); if (responseMessage.IsSuccessStatusCode) { MessageBox.Show("Alerts Status is Changed"); await GetAlerts(alertContext); } else { MessageBox.Show("response not as expected, ID may be wrong"); } }
public async Task GetAlerts(AlertManagerViewModel alertContext) { string icuID = alertContext.ICUID; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("https://localhost:5001/"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage responseMessage = await client.GetAsync($"api/patientsmonitoring/{icuID}"); if (responseMessage.IsSuccessStatusCode) { var jsonContent = responseMessage.Content.ReadAsStringAsync().Result; alertContext.ListOfAlerts = JsonConvert.DeserializeObject <List <Alert> >(jsonContent); //MessageBox.Show(alertContext.ListOfAlerts.Count.ToString()); } else { MessageBox.Show("response not as expected"); } }