Exemplo n.º 1
0
        public ContentResult ToEditPDAUser(FormCollection userform)
        {
            int     ID      = int.Parse(userform["UserId"].ToString());
            PDAUser pdauser = PDAUser.GetEntityByID(ID);

            pdauser.Password   = userform["Password"].ToString();
            pdauser.PRealName  = userform["PRealName"].ToString();
            pdauser.Remark     = userform["Remark"].ToString();
            pdauser.SupplierID = userform["SupplierID"] != null?int.Parse(userform["SupplierID"]) : 0;

            int iRet = pdauser.UpdateByID();

            if (iRet > 0)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("添加失败!"));
            }
        }
Exemplo n.º 2
0
        protected override void Initialize(HttpControllerContext controllerContext)
        {
            HttpContextBase context = (HttpContextBase)controllerContext.Request.Properties["MS_HttpContext"];//获取传统context
            HttpRequestBase request = context.Request;

            if (request["UserToken"] != null)
            {
                UserToken = request["UserToken"].ToString();

                if (!string.IsNullOrWhiteSpace(UserToken))
                {
                    CachePDAUser User = PDAUserMsg.TokenGetUser(UserToken);
                    if (User != null)
                    {
                        PdaUser = PDAUser.GetEntityByID(User.UserID);
                    }
                }
            }

            base.Initialize(controllerContext);
        }