public ActionResult Login(TBL_USER_D user) { PathologyEntities db = new PathologyEntities(); var usr = db.TBL_USER_D.SingleOrDefault(x => x.USER_NAME == user.USER_NAME && x.USER_PASSWORD == user.USER_PASSWORD); if (usr != null) { if (usr.org == "admin") { FormsAuthentication.SetAuthCookie(usr.USER_NAME, false); return(RedirectToAction("Index", "Home", new { user = user.USER_NAME })); } else if (usr.USER_NAME == "st") { FormsAuthentication.SetAuthCookie(usr.USER_NAME.ToString(), false); return(RedirectToAction("StudentDashBaord", "Home")); } else { FormsAuthentication.SetAuthCookie(usr.USER_NAME, false); return(RedirectToAction("staffDashboard", "Home", new { id = usr.USER_NAME })); } } else { ViewBag.triedOnce = "yes"; return(View()); } }
public ActionResult User_Login(TBL_USER_D objUser) { var user = db.TBL_USER_D.Where(x => x.USER_ID == objUser.USER_ID && x.USER_PASSWORD == objUser.USER_PASSWORD).FirstOrDefault(); if (user != null) { return(RedirectToAction("AdminDashboard")); } else { ViewBag.Message = "Unsuccessfull!...Try Again"; return(View()); } }
public ActionResult Login(TBL_USER_D user) { var usr = db.TBL_USER_D.SingleOrDefault(x => x.USER_NAME == user.USER_NAME && x.USER_PASSWORD == user.USER_PASSWORD); if (usr != null) { Session["user_id"] = usr.USER_ID; Session["user_n"] = usr.USER_NAME; Session["user_org"] = usr.ORG; Session["user_rorgname"] = usr.TBL_ORGINATION.ORGNAME; if (usr.MAG_ACT == 1) { FormsAuthentication.SetAuthCookie(usr.USER_NAME, false); return(RedirectToAction("AdminDashboard", "Home", new { user = user.USER_NAME })); } else if (usr.MAG_ACT == 2) { FormsAuthentication.SetAuthCookie(usr.USER_NAME, false); return(RedirectToAction("ReceptionistDashboard", "Home", new { id = usr.USER_NAME })); } else if (usr.MAG_ACT == 3) { FormsAuthentication.SetAuthCookie(usr.USER_NAME, false); return(RedirectToAction("PathHashDashboard", "Home", new { id = usr.USER_NAME })); } else { FormsAuthentication.SetAuthCookie(usr.USER_NAME, false); return(RedirectToAction("staffDashboard", "Home", new { id = usr.USER_NAME })); } } else { ViewBag.triedOnce = "yes"; return(View()); } }