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 }));
        }
        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 }));
        }
 public ActionResult GetCurrentEnvironment()
 {
     return(this.Direct(new { Environment = SessionStateManager.GetEnvironment(HttpContext.Session) }));
 }