// Homepage for this table shows all the bookings, this can be adjusted later // GET: AppointmentBooking public ActionResult Index() { List <ListAppointment> ViewModel = new List <ListAppointment> { }; string url = "AppointmentBookingData/ListAppointmentBookings"; HttpResponseMessage httpResponse = client.GetAsync(url).Result; if (httpResponse.IsSuccessStatusCode) { IEnumerable <AppointmentBookingDto> BookingList = httpResponse.Content.ReadAsAsync <IEnumerable <AppointmentBookingDto> >().Result; foreach (var item in BookingList) { url = "DoctorData/GetDoctor/" + item.DoctorID; httpResponse = client.GetAsync(url).Result; ListAppointment listAppointment = new ListAppointment { appointmentBookingDto = item, isadmin = User.IsInRole("Admin"), doctorDto = httpResponse.Content.ReadAsAsync <DoctorDTO>().Result }; ViewModel.Add(listAppointment); } Debug.WriteLine(ViewModel); return(View(ViewModel)); } else { return(RedirectToAction("Error")); } }
// Shows detail for a certain entry // GET: AppointmentBooking/Details/5 public ActionResult Details(int id) { string url = "AppointmentBookingData/GetAppointmentBooking/" + id; HttpResponseMessage httpResponse = client.GetAsync(url).Result; if (httpResponse.IsSuccessStatusCode) { AppointmentBookingDto selectedBooking = new AppointmentBookingDto(); selectedBooking = httpResponse.Content.ReadAsAsync <AppointmentBookingDto>().Result; url = "DoctorData/GetDoctor/" + selectedBooking.DoctorID; httpResponse = client.GetAsync(url).Result; ListAppointment ViewModel = new ListAppointment { isadmin = User.IsInRole("Admin"), appointmentBookingDto = selectedBooking, doctorDto = httpResponse.Content.ReadAsAsync <DoctorDTO>().Result }; return(View(ViewModel)); } else { return(RedirectToAction("Error")); } }
private void ListAppointment_Click(object sender, RoutedEventArgs e) { ListAppointment ListAppointmentPage = new ListAppointment(); MainFrame.Navigate(ListAppointmentPage); }