Exemplo n.º 1
0
        public UserUIModel GetUserById(int userid)
        {
            using (var db = new EFContext())
            {
                UserUIModel user = new UserUIModel();
                user = db.SysUsers
                       .Select(x => new UserUIModel()
                {
                    UserIdUIModel          = x.UserId,
                    UserGenderUIModel      = x.UserGender,
                    UserPwdUIModel         = x.UserPwd,
                    UserNickNameUIModel    = x.UserNickName,
                    UserPhoneNumberUIModel = x.UserPhoneNumber,
                    RoleIdUIModel          = x.RoleId,
                })
                       .FirstOrDefault(m => m.UserIdUIModel == userid);


                if (user == null)
                {
                    user = null;
                    throw new Exception("此用户信息不存在,请您刷新列表后再操作!");
                }
                return(user);
            }
        }
Exemplo n.º 2
0
        public ActionResult UpdateInit(int userid)
        {
            JsonResultData <UserUIModel> resultdata = new JsonResultData <UserUIModel>();

            try
            {
                UserUIModel user = userservice.GetUserById(userid);

                if (user == null)
                {
                    resultdata.Code = 0;
                    resultdata.Data = user;
                }
                else
                {
                    resultdata.Code = 1;
                    resultdata.Data = user;
                }
            }
            catch (Exception ex)
            {
                resultdata.Msg = ex.Message;
            }
            return(Json(resultdata, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
 public static void InitUser(PlayerInfo user)
 {
     if (CurrentUser == null)
     {
         CurrentUser = new UserUIModel(user);
     }
     else
     {
         CurrentUser.ParentObject = user;
     }
 }