public ActionResult ViewAppointment() { int memid = Convert.ToInt32(Session["MemberId"]); using (ProjectEntities1 im = new ProjectEntities1()) { var pdata = im.Patients.FirstOrDefault(a => a.MemberId == memid); var gdata = im.DoctorAppointments.ToList().Where(a => a.PatientId == pdata.PatientId); List <DoctorAppModel> lst = new List <DoctorAppModel>(); foreach (var item in gdata) { lst.Add(new DoctorAppModel { DoctorName = item.Doctor.FirstName + " " + item.Doctor.LastName, Subject = item.Subject, Description = item.Description, AppointmentDate = item.AppointmentDate, AppointmentStatus = item.AppointmentStatus }); } DoctorAppModel docViewModel = new DoctorAppModel(); docViewModel.lstDoc = lst; return(View(docViewModel)); } }
public ActionResult PostDoctorAppointment(DoctorAppModel da) { CommonData model = new CommonData(); if (!ModelState.IsValid) { da.doclst = model.DoctorApp(); return(View("DoctorAppointment", da)); } int memid = Convert.ToInt32(Session["MemberId"]); using (ProjectEntities1 im = new ProjectEntities1()) { var getdata = im.Patients.FirstOrDefault(a => a.MemberId == memid); da.AppointmentStatus = "Requested"; int id = Convert.ToInt32(getdata.PatientId); im.InsertDoctorApp(id, da.DoctorId, da.Subject, da.Description, da.AppointmentDate, da.AppointmentStatus); } CommonData mcm = new CommonData(); da.doclst = mcm.DoctorApp(); ViewBag.message = "Appointment Requested !"; return(View("DoctorAppointment", da)); }
public ActionResult DoctorAppointment() { CommonData model = new CommonData(); DoctorAppModel m = new DoctorAppModel(); m.doclst = model.DoctorApp(); return(View(m)); }
public ActionResult PostViewAppointment(DoctorAppModel doctorAppModel) { using (ProjectEntities1 db = new ProjectEntities1()) { db.UpdateAppStatus(doctorAppModel.AppointmentId, doctorAppModel.AppointmentStatus); } return(Json("Inserted")); }