public ActionResult BookingSlot(int id, string time, string datepicker) { var doctor = DbContext.Doctors.SingleOrDefault(m => m.DoctorId == id); ViewBag.Time = time; ViewBag.Date = datepicker; TempData["Time"] = time; TempData["Date"] = datepicker; var d = new DoctorPatientViewModel { DoctorId = doctor.DoctorId, DoctorName = doctor.DoctorName, Specialization = doctor.Specialization, Qualification = doctor.Qualification, Experience = doctor.Experience, ShiftDetails = doctor.ShiftDetails, Languages = doctor.Languages, }; return(View("BookingDoctor", d)); }
public IActionResult Index() { DoctorPatientViewModel model = new DoctorPatientViewModel(); foreach (Patient current in patientService.GetUsers()) { model.Patients.Add(current); } foreach (Doctor current in doctorService.GetDoctors()) { model.Doctors.Add(current); } return(View(model)); }
public ActionResult BookingDoctor(DoctorPatientViewModel ViewModel) { var employee = DbContext.Employees.ToList(); Appointment PatientDetails = new Appointment { SlotTime = Convert.ToDateTime(TempData["Time"]), EmployeeId = Convert.ToInt16(TempData["Id"]), AppointmentDate = Convert.ToDateTime(TempData["Date"]), AppointmentStatus = true, }; DbContext.Appointments.Add(PatientDetails); DbContext.SaveChanges(); return(Content("Booked Successfully")); }
public async Task <IActionResult> OnlineChat(int doctorId, int patientId, string reserveDateTime) { if (doctorId == 0 || patientId == 0 || string.IsNullOrEmpty(reserveDateTime)) { return(NotFound()); } var doctor = await _db.Doctors.FindAsync(doctorId); var patient = await _db.Patients.FindAsync(patientId); if (doctor == null || patient == null) { return(NotFound()); } if (!DateTime.TryParse(reserveDateTime, out var reserveDateTimeResult)) { return(NotFound()); } var visit = await _db.Visits.FirstOrDefaultAsync(a => a.ReservationDoctorId.Equals(doctorId) && a.ReservationPatientId.Equals(patientId) && a.ReservationReserveDate.Equals(reserveDateTimeResult) && a.ChatFlag.Equals(false)); if (visit == null) { return(NotFound()); } if (User.IsInRole("Doctor")) { //visit.ChatFlag = true; TODO: deleted for experimental actions //_db.Visits.Update(visit); //await _db.SaveChangesAsync(); } ViewBag.ReserveDateTime = reserveDateTimeResult; DoctorPatientViewModel doctorPatient = new DoctorPatientViewModel(doctor, patient); return(View(doctorPatient)); }
public async Task <IActionResult> Chat(string reserveDate, int doctorId = 0, int patientId = 0) { if (doctorId == 0 || patientId == 0 || string.IsNullOrEmpty(reserveDate)) { return(NotFound()); } if (!DateTime.TryParse(reserveDate, out var reservDateTime)) { return(NotFound()); } var doctor = await _db.Doctors.FindAsync(doctorId); var patient = await _db.Patients.FindAsync(patientId); if (doctor == null || patient == null) { return(NotFound()); } var isQualified = await _db.Visits .AnyAsync(a => a.ReservationDoctorId.Equals(doctorId) && a.ReservationPatientId.Equals(patientId) && a.ReservationReserveDate.Equals(reservDateTime) && a.ChatFlag.Equals(false)); if (!isQualified) { TempData["Error"] = "شما نمی توانید بیش از یک بار به ازای هر ویزیت، گفتگوی آنلاین داشته باشید"; return(RedirectToAction("VisitList")); } var viewModel = new DoctorPatientViewModel(doctor, patient); ViewBag.DoctorId = doctorId; ViewBag.PatientId = patientId; ViewBag.ReserveDateTime = reservDateTime; return(View(viewModel)); }