public async void AddCare(Soin soin) { HttpClient client = new HttpClient(); var json = JsonConvert.SerializeObject(soin); HttpContent content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync("http://nurseapi.azurewebsites.net/api/soins", content); if (response.IsSuccessStatusCode) { await new MessageDialog("Success !").ShowAsync(); } else { await new MessageDialog("Add Failed !").ShowAsync(); } }
public void AddCare() { Soin soin = new Soin(); String date = DateSelected.Day + "-" + DateSelected.Month + "-" + DateSelected.Year; soin.dateSoin = date; soin.IdInfi = NurseSelected.IdInfirmier; soin.IdPatient = PatientSelected.IdPatient; myDataAccess.AddCare(soin); new MessageDialog("Ajout confirmé").ShowAsync(); }