Esempio n. 1
0
 public ActionResult Login(patient p)
 {
     using (FINALSCRIPTTEntities db = new FINALSCRIPTTEntities())
     {
         var usr = db.patients.SingleOrDefault(u => u.email == p.email);
         if (usr != null)
         {
             if (usr.password.ToString() == p.password.ToString())
             {
                 Session["email"] = usr.email.ToString();
                 return(RedirectToAction("SelectDoctor"));
             }
         }
         else
         {
             ModelState.AddModelError("", "Email or password is wrong");
         }
     }
     return(View(p));
 }
Esempio n. 2
0
 public ActionResult Login(doctor p)
 {
     using (FINALSCRIPTTEntities db = new FINALSCRIPTTEntities())
     {
         var usr = db.doctors.SingleOrDefault(u => u.doctor_id == p.doctor_id);
         if (usr != null)
         {
             if (usr.password.ToString() == p.password.ToString())
             {
                 Session["doctor_id"] = usr.doctor_id.ToString();
                 return(RedirectToAction("DoctorWelcome1", "doctor_scedule", new { ide = usr.doctor_id.ToString() }));
             }
         }
         else
         {
             ModelState.AddModelError("", "Email or password is wrong");
         }
     }
     return(View(p));
 }