Exemple #1
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="userId">用户Id</param>
        public void DeleteUser(long userId)
        {
            User user   = userRepository.GetUser(userId);
            var  result = userRepository.DeleteCache(user);

            if (result)
            {
                UserIdToUserNameDictionary.RemoveUserId(userId);
                UserIdToUserNameDictionary.RemoveUserName(user.UserName);
            }
        }
Exemple #2
0
        /// <summary>
        /// 根用户Id集合删除用户
        /// </summary>
        /// <param name="userIds">用户Id集合</param>
        public void DeleteUsers(IEnumerable <long> userIds)
        {
            List <User> users = new List <User>();

            foreach (var userId in userIds)
            {
                User user = userRepository.GetUser(userId);
                if (user == null)
                {
                    continue;
                }
                var result = userRepository.DeleteCache(user);

                if (result)
                {
                    UserIdToUserNameDictionary.RemoveUserId(userId);
                    UserIdToUserNameDictionary.RemoveUserName(user.UserName);
                }
            }
        }