public ActionResult GetAppointmentsVacantByJson() { if (!Authorize()) { return(RedirectToAction("RedirectByUser", "Home")); } AppointmentDal appDal = new AppointmentDal(); List <Appointment> appointments = (from app in appDal.Appointments where app.PatientUserName == null && DateTime.Compare(DateTime.Now, app.Date) < 0 select app).ToList <Appointment>(); Thread.Sleep(1000); return(Json(appointments, JsonRequestBehavior.AllowGet)); }
public ActionResult AppointmentScheduling() { if (!Authorize()) { return(RedirectToAction("RedirectByUser", "Home")); } AppointmentViewModel AppVM = new AppointmentViewModel(); AppointmentDal appDal = new AppointmentDal(); AppVM.Appointments = (from app in appDal.Appointments where app.PatientUserName == null && DateTime.Compare(DateTime.Now, app.Date) < 0 select app).ToList <Appointment>(); return(View(AppVM)); }
public ActionResult YourAppointments() { if (!Authorize()) { return(RedirectToAction("RedirectByUser", "Home")); } User curr = (User)Session["CurrentUser"]; AppointmentViewModel AppVM = new AppointmentViewModel(); AppointmentDal appDal = new AppointmentDal(); AppVM.Appointments = (from app in appDal.Appointments where app.PatientUserName == curr.UserName && DateTime.Compare(DateTime.Now, app.Date) < 0 select app).ToList <Appointment>(); return(View(AppVM)); }
public ActionResult GetYourAppointmentssByJson() { if (!Authorize()) { return(RedirectToAction("RedirectByUser", "Home")); } User currentUser = (User)Session["CurrentUser"]; AppointmentDal appDal = new AppointmentDal(); PatientDal pdal = new PatientDal(); Patient currentPatient = pdal.Patients.FirstOrDefault <Patient>(x => x.UserName == currentUser.UserName); List <Appointment> appointments = (from app in appDal.Appointments where app.PatientUserName == currentPatient.UserName && DateTime.Compare(DateTime.Now, app.Date) < 0 select app).ToList <Appointment>(); Thread.Sleep(1000); return(Json(appointments, JsonRequestBehavior.AllowGet)); }
public ActionResult CancelAppointment(string DoctorName, DateTime date) { if (!Authorize()) { return(RedirectToAction("RedirectByUser", "Home")); } Appointment chosen = new Appointment { DoctorName = DoctorName, Date = date }; AppointmentDal appDal = new AppointmentDal(); Appointment update = appDal.Appointments.FirstOrDefault <Appointment>(x => x.Date == chosen.Date && x.DoctorName == chosen.DoctorName); update.PatientUserName = null; appDal.SaveChanges(); DoctorDal dctDal = new DoctorDal(); return(View("PatientPage")); }
public ActionResult ChooseAppointment(string DoctorName, DateTime date) { if (!Authorize()) { return(RedirectToAction("RedirectByUser", "Home")); } Appointment chosen = new Appointment { DoctorName = DoctorName, Date = date }; PatientDal pdal = new PatientDal(); User currentUser = (User)Session["CurrentUser"]; Patient currentPatient = pdal.Patients.FirstOrDefault <Patient>(x => x.UserName == currentUser.UserName); AppointmentDal appDal = new AppointmentDal(); Appointment update = appDal.Appointments.FirstOrDefault <Appointment>(x => x.Date == chosen.Date && x.DoctorName == chosen.DoctorName); update.PatientUserName = currentPatient.UserName; appDal.SaveChanges(); return(View("PatientPage")); }