public ActionResult PatientLoginCode(HealthApp.Models.Patient pal) { using (HealthAppEntities pl = new HealthAppEntities()) { var plcv = pl.Patients.Where(p => p.PatientLoginCode == pal.PatientLoginCode).FirstOrDefault(); if (plcv == null) { pal.LoginErrorMessage = "Incorrect username or password"; return(View("PatientLoginCode", pal)); } else { Session["LoggedPatientId"] = plcv.PatientID; Session["LoggedPatientFName"] = plcv.PatientFName; Session["LoggedPatientLName"] = plcv.PatientSName; return(RedirectToAction("PatientHome", "Home")); } } }
public ActionResult DoctorLogin(HealthApp.Models.Doctor da) { using (HealthAppEntities dl = new HealthAppEntities()) { var dlv = dl.Doctors.Where(d => d.DoctorEmail == da.DoctorEmail && d.DoctorPass == da.DoctorPass).FirstOrDefault(); if (dlv == null) { da.LoginErrorMessage = "Incorrect username or password"; return(View("DoctorLogin", da)); } else { Session["LoggedDoctorId"] = dlv.DoctorID; Session["LoggedDoctorFName"] = dlv.DoctorFName; Session["LoggedDoctorLName"] = dlv.DoctorSName; return(RedirectToAction("DoctorHome", "Home")); } } }