public ActionResult LoginPopUp(LoginModel model, string returnUrl) { if (model != null) { DataTable dt = new DataTable(); Login login = new Login(); if (!string.IsNullOrEmpty(model.Password)) { login.EmailId = model.UserName; login.Password = CryptorEngine.Encrypt(model.Password, true); dt = Logininfo.GetLoginDetails(login); if (dt != null && dt.Rows.Count > 0) { if (ModelState.IsValid) { Session["loggedinas"] = model.LoggedInAs; string userName = dt.Rows[0][1].ToString(); Session["username"] = string.Format("Hello,{0}", userName); return RedirectToLocal(returnUrl); } } } } ModelState.AddModelError("", "The user name or password provided is incorrect."); return RedirectToAction("Home", "Home"); }
public static DataTable GetLoginDetails(Login login) { return AccountAccess.GetLoginDetails(login.EmailId, login.Password); }