public ActionResult Login(tblPatient p) { if (ModelState.IsValid) { using (ClinicEntities2 db = new ClinicEntities2()) { try { var g = db.tblPatients.Where(x => x.Patient_Code == p.Patient_Code && x.Patient_Password == p.Patient_Password).FirstOrDefault(); //var d=db.tblDoctors.Where(x=>x.Doctor_Code ) if (g != null) { Session["PatientCode"] = g.Patient_Code.ToString(); Session["PatientID"] = g.Patient_Id.ToString(); return(RedirectToAction("Index", "AppointmentHome")); } else if (p.Patient_Code == "Admin" && p.Patient_Password == "1234") { return(RedirectToAction("Index", "Appointments")); } } catch (Exception ex) { } } } return(View(p)); }
public ActionResult ViewStatus(tblAppointment a) { var db = new ClinicEntities2(); var g = db.tblAppointments.Where(x => x.Patient_Code == a.Patient_Code ).FirstOrDefault(); //var d=db.tblDoctors.Where(x=>x.Doctor_Code ) try { if (g != null) { Session["PatientCode"] = g.Patient_Code.ToString(); ViewBag.Status = g.Status; } } catch (Exception ex) { } return(View(a)); }