コード例 #1
0
        public UserListResponse LoadAll(string language, string sessionId)
        {
            AppUser admin = this.LoadUserWithSessionId(sessionId);

            ValidateSessionAndRight(language, admin, EnumData.AppModules.AppUser.ToString(), new List <string> {
                EnumData.RoleRight.all.ToString()
            });
            string errorMessageKey = "";

            try
            {
                errorMessageKey = ConstentMessages.ServerError;
                IEnumerable <AppUser> userList = _work.LoadAllUser();
                List <UserResponse>   list     = new List <UserResponse>();
                foreach (AppUser user in userList)
                {
                    list.Add(CreateUserResponseFromUser(user));
                }
                this.UpdateAdminSession(admin);
                return(new UserListResponse
                {
                    SessionId = admin.Session.Id,
                    SessionUpdateTs = admin.Session.UpdateTs.ToJsTime(),
                    UserList = list
                });
            }
            catch (Exception ex)
            {
                throw new TranslationException(_translator, language, errorMessageKey, ex);
            }
        }