Пример #1
0
        //[EnableCors("http://localhost:8805","*","*")]
        public HttpResponseMessage LoginOn(string userName, string passWord, string timestamp, bool remeberMe = false,
                                           string returnUrl = "")
        {
            var UserValidate = MemberShipBase.GetMemberShipServiceInstance().ValidateLogin(userName, passWord);

            if (!UserValidate.Item1)
            {
                resultMsg            = new ResultMsg();
                resultMsg.StatusCode = (int)StatusCodeEnum.Unauthorized;
                resultMsg.Info       = StatusCodeEnum.Unauthorized.GetEnumText();
                resultMsg.Data       = UserValidate.Item2;
                return(HttpResponseExtension.toJson(JsonConvert.SerializeObject(resultMsg)));
            }


            var data = MemberShipBase.GetMemberShipServiceInstance().GetToken(userName, timestamp, remeberMe);

            resultMsg            = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            resultMsg.Info       = StatusCodeEnum.Success.GetEnumText();
            resultMsg.Data       = data;

            //var getRole=
            return(HttpResponseExtension.toJson(JsonConvert.SerializeObject(resultMsg)));
        }
Пример #2
0
        public HttpResponseMessage GetUserInfo(string userName)
        {
            var data = MemberShipBase.GetMemberShipServiceInstance().GetUserInfo(userName);

            resultMsg            = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            resultMsg.Info       = StatusCodeEnum.Success.GetEnumText();
            resultMsg.Data       = data;
            return(HttpResponseExtension.toJson(JsonConvert.SerializeObject(resultMsg)));
        }
Пример #3
0
        public HttpResponseMessage LoginOut(string userName)
        {
            bool loginOut = MemberShipBase.GetMemberShipServiceInstance().LoginOut(userName);

            if (loginOut)
            {
                resultMsg            = new ResultMsg();
                resultMsg.StatusCode = (int)StatusCodeEnum.Success;
                resultMsg.Info       = StatusCodeEnum.Success.GetEnumText();
                resultMsg.Data       = "登出成功!";
            }
            else
            {
                resultMsg            = new ResultMsg();
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info       = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data       = "退出出错!";
            }
            return(HttpResponseExtension.toJson(JsonConvert.SerializeObject(resultMsg)));
        }