Teacher Login Controller

[HttpPost]
        public ActionResult tchlogin(Teacher t)
        {

            Teacher res = db.Teachers.Where(x => x.teacher_email == t.teacher_email & x.teacher_password== t.teacher_password).FirstOrDefault();
            if (res != null)
            {


                Session["tch"] = res;
                return RedirectToAction("index","Teacher");


            }

            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