public ActionResult PatientAppointmentList() { var userName = User.Identity.GetUserName(); var appointmentList = db.Appointments.Where( o => o.PatientUserName == userName) .ToList(); AppointmentListViewModel vm = new AppointmentListViewModel(); vm.PatientName = userName; vm.ApoointmentModels = appointmentList; return View(vm); }
public ActionResult AppointmentList() { var userName = User.Identity.GetUserName(); var doctor = db.Doctors.FirstOrDefault(o => o.UserName == userName); var appointmentList = db.Appointments.Where( o => o.DoctorName == doctor.UserName) .ToList(); AppointmentListViewModel vm=new AppointmentListViewModel(); vm.DoctorName = doctor.FirstName + " " + doctor.LastName; vm.ApoointmentModels = appointmentList.Where(o=> o.AppointmentDateTime.Value.Date >= DateTime.Now.Date).ToList(); vm.HighAlertCount = appointmentList.Where(o => o.AppointmentDateTime.Value.Date == DateTime.UtcNow.Date).Count(); vm.MidAlertCount = appointmentList.Where(o => o.AppointmentDateTime.Value.Date == DateTime.UtcNow.AddDays(1).Date).Count(); vm.NoRiskAlertCount = appointmentList.Where(o => o.AppointmentDateTime.Value.Date > DateTime.UtcNow.AddDays(1).Date).Count(); return View(vm); }