Example #1
0
 public void Table()               //display the table
 {
     uiDataGridView1.Rows.Clear(); //flush the old data
     using UserController userMapper = new UserController();
     foreach (User user in userMapper.GetAllUsers())
     {
         uiDataGridView1.Rows.Add(UserExtentions.getUserDetails(user.ToStringArray()));
     }
 }
Example #2
0
        public ApiResponse <UserModel> GetUserDetail(int id)
        {
            if (id < 1)
            {
                throw new Exception("Invalid id.");
            }

            var user    = this.UserService.GetUserDetail(id);
            var current = UserTokenService.GetMemberByToken(this.Token);

            UserExtentions.HidePhone(current, user); //隐藏电话号码

            ApiResponse <UserModel> response = new ApiResponse <UserModel>()
            {
                Result = user
            };

            return(response);
        }
Example #3
0
        public ApiResponse <UserModel> GetUserDetail(SingleUserModel model)
        {
            if (model == null || (string.IsNullOrEmpty(model.Phone) && string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.ChineseName) &&
                                  string.IsNullOrEmpty(model.EnglishName) && string.IsNullOrEmpty(model.QQID)))
            {
                throw new Exception("The request body cant't be null.");
            }

            var user    = this.UserService.GetUserDetail(model);
            var current = UserTokenService.GetMemberByToken(this.Token);

            UserExtentions.HidePhone(current, user); //隐藏电话号码

            ApiResponse <UserModel> response = new ApiResponse <UserModel>()
            {
                Result = user
            };

            return(response);
        }