public ActionResult Login(string returnUrl) { LoginModel Model = new LoginModel(); Model.SucessMessage = (TempData[Message.Success] != null ? TempData[Message.Success].ToString() : string.Empty).ToString(); Model.ErrorMessage = (TempData[Message.Error] != null ? TempData[Message.Error].ToString() : string.Empty).ToString(); return View(Model); }
public ActionResult LoginUser(LoginModel Model) { if (ModelState.IsValid) { UserBL UserBL = new BL.BusinessLayer.UserBL(); UserBM User = UserBL.GetUsers().Where(p => p.Email == Model.Email && p.Password == Model.Password).FirstOrDefault(); if (User != null) { User.IsOnline = true; UserBL.UpdateUser(User); User.Image = UserGeneralInformationBL.GetGeneralInformationByUserId(User.Id) != null ? UserGeneralInformationBL.GetGeneralInformationByUserId(User.Id).Image : string.Empty; SessionManager.InstanceCreator.Set<UserBM>(User, SessionKey.User); // Session["User"] = User; FormsAuthentication.SetAuthCookie(User.Name, false); return RedirectToAction("DashBoard", "Home"); } else { TempData["Error"] = "Invalid username and password"; return RedirectToAction("Login"); } } return RedirectToAction("Login"); }
public ActionResult ForgotPassword(LoginModel Model) { TempData["Success"] = "Password Has been send on your emal."; return RedirectToAction("Login"); }