public static async Task <AppointmentM> GetAppointmentByID(string id, string email) { Debug.WriteLine("heredfasdfasdf "); AppointmentM appointment = null; HttpClient client = new HttpClient(); //add header with user id client.DefaultRequestHeaders.Accept.Add (new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("id", id); client.DefaultRequestHeaders.Accept.Add (new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("email", email); string URL = "http://" + serverAddress + ":" + serverPort + AddAppointmentURL; var res = await client.GetAsync(URL); if (res.IsSuccessStatusCode) { Debug.WriteLine("heredfasdfasdf "); var contentr = await res.Content.ReadAsStringAsync(); appointment = JsonConvert.DeserializeObject <AppointmentM>(contentr); Debug.WriteLine("heredfasdfasdf "); Debug.WriteLine(appointment.PatientID); } return(appointment); }
public static async Task <Res> UpdateAppointment(AppointmentM appointment, string email) { HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Accept.Add (new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("email", email); var post = new Put { Title = "New Post", Body = JsonConvert.SerializeObject(appointment) }; string URL = "http://" + serverAddress + ":" + serverPort + AddAppointmentURL; var content = new StringContent(JsonConvert.SerializeObject(post), Encoding.UTF8, "application/json"); var res = await client.PutAsync(URL, content); string resBody = await res.Content.ReadAsStringAsync(); Res response = JsonConvert.DeserializeObject <Res>(resBody);//JsonParse(resBody); return(response); }
private async void Av_OnUsedSlotTapped(object sender, SlotWithAppointmetTappedEvent e) { DeleteAppointment.IsEnabled = true; av.CleartHighLighted(); av.HighLightSlot(e.X, e.Y); //selectedAppointment = DAO.GetAppointmentByID(e.AppointmentID); selectedAppointment = await AppointmentMlab.GetAppointmentByID(e.AppointmentID, App.ActualUser.Email); selectedCustomerApp = DAO.GetCustomerByID(selectedAppointment.PatientID); NameLabel.Text = selectedCustomerApp.name + " " + selectedCustomerApp.surname; DateLabel.Text = selectedAppointment.Date.ToString("dddd, dd MMMM yyyy HH:mm:ss"); }