public ActionResult ProcessAppointment(DoctorAppointTable app) { if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"]))) { return(RedirectToAction("Login", "Home")); } if (ModelState.IsValid) { db.Entry(app).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("PendingAppointment")); } return(View(app)); }
public ActionResult ChangeStatus(DoctorAppointTable app) { if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"]))) { return(RedirectToAction("Login", "Home")); } if (ModelState.IsValid) { db.Entry(app).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("PendingAppointment")); } ViewBag.DoctorTimeSlotID = new SelectList(db.DoctorTimeSlotTables.Where(d => d.DoctorID == app.DoctorID), "DoctorTimeSlotID", "DoctorTimeSlotID", app.DoctorTimeSlotID); return(View(app)); }
public ActionResult DoctorAppointment(DoctorAppointTable appointment) { if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"]))) { return(RedirectToAction("Login", "Home")); } appointment.DoctorComment = string.Empty; appointment.IsChecked = false; appointment.IsFeeSubmit = false; var patient = (PatientTable)Session["Patient"]; appointment.PatientID = patient.PatientID; appointment.DoctorID = Convert.ToInt32(Convert.ToString(Session["docid"])); if (ModelState.IsValid) { var checktransection = db.DoctorAppointTables.Where(c => c.TransectionNo == appointment.TransectionNo).FirstOrDefault(); if (checktransection == null) { var find = db.DoctorAppointTables.Where(p => p.DoctorTimeSlotID == appointment.DoctorTimeSlotID && p.DoctorID == appointment.DoctorID && p.AppointDate == appointment.AppointDate).FirstOrDefault(); if (find == null) { db.DoctorAppointTables.Add(appointment); db.SaveChanges(); ViewBag.Message = "Appointment Submited Success "; } else { ViewBag.Message = "Time Slot Is Already Assign ..(Another Patient)"; } } else { ViewBag.Message = "Transection No Is Already Used.. For Another Transection "; } } ViewBag.DoctorTimeSlotID = new SelectList(db.DoctorTimeSlotTables.Where(d => d.DoctorID == appointment.DoctorID && d.IsActive == true), "DoctorTimeSlotID", "Name", "0"); return(View()); }