public ActionResult Appoitment(PatientDoctors model) { int appointmentId = Appointment.CreateAppointment(int.Parse(Request["PatientId"]), int.Parse(Request["DoctorId"]), DateTime.Parse(Request["DOA"]), Request["Symptoms"], Request["Indications"], Request["Advice"], Request["Medications"], Request["Comments"], double.Parse(Request["Fees"])); TempData["Msg"] = "New Appointment Successfully created, with Appointment Id = " + appointmentId; return(RedirectToAction("Appoitments")); }
public ActionResult Appoitment(int id) { Patient patient = Patient.GetAllPatients().Find(p => p.PatientId == id); List <Doctor> doctors = Doctor.GetAllDoctors(); PatientDoctors patientDoctors = new PatientDoctors() { Patient = patient, Doctors = doctors }; return(View(patientDoctors)); }
public ActionResult Edit(PatientDoctorsVM patientDocs) { if (ModelState.IsValid) { Patient patient = patientDocs.Patient; db.Entry(patient).State = EntityState.Modified; db.SaveChanges(); PatientDoctors doctorAssigned = new PatientDoctors(); doctorAssigned.Patient_Id = patientDocs.Patient.Id; var assignedDoctors = db.PatientDoctors.Where(p => p.Patient_Id == patient.Id).ToList(); foreach (var doctor in patientDocs.AllDoctors.Where(s => s.IsSelected)) { doctorAssigned.Doctor_Id = doctor.Id; db.PatientDoctors.Add(doctorAssigned); db.SaveChanges(); } } return(RedirectToAction("Index")); }