コード例 #1
0
ファイル: patientsController.cs プロジェクト: Maham456/book
 public ActionResult Login(patient p)
 {
     using (bookdoctorEntities3 db = new bookdoctorEntities3())
     {
         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));
 }
コード例 #2
0
ファイル: doctorsController.cs プロジェクト: Maham456/book
 public ActionResult Login(doctor p)
 {
     using (bookdoctorEntities3 db = new bookdoctorEntities3())
     {
         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("DoctorWelcome"));
             }
         }
         else
         {
             ModelState.AddModelError("", "Email or password is wrong");
         }
     }
     return(View(p));
 }
コード例 #3
0
        public ActionResult Login(AspNetUserLogin p)
        {
            using (bookdoctorEntities3 db = new bookdoctorEntities3())
            {
                var usr = db.AspNetUserLogins.SingleOrDefault((u => u.Email == p.Email));

                if (usr != null)
                {
                    if (usr.password.ToString() == p.password.ToString())
                    {
                        Session["Email"] = usr.Email.ToString();
                        return(RedirectToAction("DoctorWelcome"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Email or password is wrong or maybe you are not registered");
                }
            }
            return(View(p));
        }