Beispiel #1
0
        public BaseController()
        {
            var user = LoginCookieHelper.GetCurrentUser();

            if (user != null)
            {
                this.CurrentUser   = LoginCookieHelper.GetCurrentUser();
                this.CurrentUserID = CurrentUser.UserId;
            }
        }
Beispiel #2
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            var teacher = LoginCookieHelper.GetCurrentUser();

            if (teacher == null && NeedLogin)
            {
                if (filterContext.HttpContext.Request.Url != null)
                {
                    if (filterContext.HttpContext.Request.IsAjaxRequest())
                    {
                        FilterContextAjaxNoLogin(filterContext);
                    }
                    else
                    {
                        FilterContextNoLogin(filterContext);
                    }
                }
                return;
            }
        }