Home Controller Std Login

[HttpPost]
        public ActionResult stdlogin(Student s)
        {
                
            Student res = db.Students.Where(x => x.student_email == s.student_email& x.student_password==s.student_password).FirstOrDefault();
            if (res!=null)
            {
                Session["studentloging"] =res;
                return RedirectToAction("index");
            }
            
            else if (res==null)
            {
                ViewBag.message = "The Email you have entered is not registered yet. Please Register Your Account Here";
                return View();
            }
            else
            {
                ViewBag.message = "Email or Password is incorrect";
                return View();
            }
        }

Leave a Comment