private void RemoveUserFromChannel(Models.User user, Guid channelId)
        {
            var channel     = _channelRepository.Get(channelId);
            var channelUser = _channelUserRepository.GetByUserIdAndChannelId(user.Id, channelId);

            _channelUserRepository.Remove(channelUser);
            _channelUserStore.RemoveByUserIdAndChannelId(user.Id, channelId);
            _channelEventService.AddUserRemovedFromChannelEvent(channel.Group, _authorizedUser, user, channel);
        }
Beispiel #2
0
        private void RemoveUserFromAssociatedChannelsInGroup(Models.User user, Guid groupId)
        {
            IEnumerable <ChannelUser> channelUsers = _channelUserRepository.GetAllByUserIdAndGroupId(user.Id, groupId);

            if (channelUsers == null || !channelUsers.Any())
            {
                return;
            }

            var group = _groupRepository.Get(groupId);

            foreach (var channelUser in channelUsers)
            {
                _channelUserRepository.Remove(channelUser);
                _channelUserStore.RemoveByUserIdAndChannelId(user.Id, channelUser.ChannelId);
                _channelEventService.AddUserRemovedFromChannelEvent(group, _authorizedUser, user, channelUser.Channel);
            }
        }