Пример #1
0
        public ActionResult SetEnvironment(String environment)
        {
            if (HttpContext.Session != null)
            {
                HttpContext.Session.Add(EnvironmentSetting, environment);
                EnvironmentServices.SetHttpSessionCache(HttpContext.Session);
                EnvironmentServices.SetEnvironment(environment);
            }

            return(this.Direct(new { success = SessionStateManager.GetEnvironment(HttpContext.Session) == environment }));
        }
Пример #2
0
        public ActionResult Login(UserLoginDto dto)
        {
            var success = !string.IsNullOrEmpty(GetEnvironment(dto));

            if (success)
            {
                SessionStateManager.InitializeDatabase(HttpContext.Session);
                LoginServices.Login(dto);
                success = LoginServices.IsLoggedIn(dto.UserName);

                if (success)
                {
                    SetLoginCookie(dto.UserName);
                }
            }
            else
            {
                return(this.Direct(new { success = false, message = NoEnvironmentMessage }));
            }

            return(this.Direct(new { success }));
        }
Пример #3
0
 public ActionResult GetCurrentEnvironment()
 {
     return(this.Direct(new { Environment = SessionStateManager.GetEnvironment(HttpContext.Session) }));
 }