コード例 #1
0
ファイル: LoginController.cs プロジェクト: ecmer/SqLiteRepo
        public ActionResult Index(Credential credent)
        {
            if (credent == null)
            {
                return(View(credent));
            }
            if (credent.DoctorID == null || credent.DoctorID.Length == 0)
            {
                TempData["message"] = "Both UserId and Password are required";
                return(View(credent));
            }
            if (credent.Password == null || credent.Password.Length == 0)
            {
                TempData["message"] = "Both UserId and Password are required";
                return(View(credent));
            }

            bool resultOfAuthenticate = DoctorManager.AuthenticateDoctor(credent, Session);

            if (resultOfAuthenticate == true)
            {
                TempData["message"] = "Login Successful";
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                TempData["message"] = "Invalid login credentials";
                return(RedirectToAction("Index", "Home"));
            }
        }