private static void CreateSession(User user) { SessionModel sessionModel = new SessionModel(); sessionModel.ID = user.ID; sessionModel.FirstName = user.FirstName; sessionModel.LastName = user.LastName; sessionModel.Email = user.Email; sessionModel.UserType = user.UserType; string sessionValue = JsonConvert.SerializeObject(sessionModel); System.Web.HttpContext.Current.Session.Add("authsession", sessionValue); }
public Tuple<LoginModel, User> Login(string email, string password, string URL) { LoginModel loginModel = new LoginModel(); UserBusiness userBusiness = new UserBusiness(); this.User = userBusiness.ExistUser(email, password); if (this.User != null) { loginModel.IsSuccess = true; loginModel.RedirectURL = string.IsNullOrEmpty(URL) ? "/Management/SiteSetting/" : URL; } else { loginModel.Alerts.AlertList.Add(ZngnCMS.Model.Authorization.Resources.LoginModelResource.IsFailure); loginModel.Alerts.AlertType = Model.Base.Alerts.AlertTypes.Error; } return new Tuple<LoginModel, User>(loginModel, User); }