public ActionResult BookingConfirm(AppointmentBookingViewModel ViewModel) { ViewModel.host = db.AppointmentHosts.Find(ViewModel.host_id); ViewModel.appointment = db.Appointments.Find(ViewModel.appointment_id); ViewModel.concerns = db.AppointmentConcerns.Where(c => ViewModel.concern_ids.Contains(c.id)).ToList(); return(View(ViewModel)); }
protected override async void OnNavigatedTo(NavigationEventArgs e1) { doc_id = (int)e1.Parameter; viewModel = new AppointmentBookingViewModel(doc_id); viewModel.InsertSuccess += this.onInsertSuccess; viewModel.InsertFail += this.onInsertFail; await viewModel.GetDoctor(doc_id); Bindings.Update(); }
public ActionResult Booking3(AppointmentBookingViewModel ViewModel) { ViewModel.host = db.AppointmentHosts.Find(ViewModel.host_id); ViewModel.appointment = db.Appointments.Find(ViewModel.appointment_id); ViewModel.concernList = db.AppointmentConcerns.Where(c => !c.custom && c.program_id == null).ToList(); if (ViewModel.concern_ids == null && ViewModel.appointment.AppointmentConcerns.Count() > 0) { ViewModel.concern_ids = ViewModel.appointment.AppointmentConcerns.Select(c => c.id).ToArray(); } return(View(ViewModel)); }
public ActionResult Booking1(AppointmentBookingViewModel ViewModel) { ViewModel.advisor = db.StudentAdvisors.FirstOrDefault(a => a.student_id == User.Identity.Name); ViewModel.hostList = db.AppointmentHosts.Where(h => h.booking && !h.Appointments.Any(o => o.student_id == User.Identity.Name && o.start_time > DateTime.Now) && h.Appointments.Count() > 0).ToList(); if (ViewModel.advisor != null) { string email = ViewModel.advisor.advisor_email; var advisorhost = db.AppointmentHosts.FirstOrDefault(h => h.SystemUsers.Any(u => u.UserName == email.Substring(0, email.IndexOf("@"))) && !h.Appointments.Any(o => o.student_id == User.Identity.Name && o.start_time > DateTime.Now)); if (advisorhost != null) { ViewModel.hostList.Add(advisorhost); } } return(View(ViewModel)); }
public ActionResult BookingSubmit(AppointmentBookingViewModel ViewModel) { ViewModel.host = db.AppointmentHosts.Find(ViewModel.host_id); ViewModel.appointment = db.Appointments.Find(ViewModel.appointment_id); ViewModel.concerns = db.AppointmentConcerns.Where(c => ViewModel.concern_ids.Contains(c.id)).ToList(); ViewModel.appointment.AppointmentConcerns.Clear(); if (!String.IsNullOrEmpty(ViewModel.other_concern)) { var otherconcern = new AppointmentConcern { name = ViewModel.other_concern, custom = true }; db.AppointmentConcerns.Add(otherconcern); ViewModel.appointment.AppointmentConcerns.Add(otherconcern); } foreach (var concern in ViewModel.concerns) { ViewModel.appointment.AppointmentConcerns.Add(concern); } var student = db.StudentProfiles.Find(User.Identity.Name); if (student != null) { ViewModel.appointment.student_id = student.id; } try { db.SaveChanges(); Session["FlashMessage"] = "Appointment has been successfully booked."; return(RedirectToAction("MyAppointment", "Appointment")); } catch (Exception e) { Session["FlashMessage"] = "Failed to make the appointment booking.<br/><br/>" + e.Message; return(RedirectToAction("Booking", "Appointment")); } }
public ActionResult Booking2(AppointmentBookingViewModel ViewModel) { ViewModel.host = db.AppointmentHosts.Find(ViewModel.host_id); ViewModel.appointmentList = db.Appointments.Where(o => o.AppointmentStatus.name == "Opened" && o.host_id == ViewModel.host_id && o.student_id == null).ToList(); return(View(ViewModel)); }