Exemple #1
0
        public async Task SetModerator(int chatId)
        {
            var chat = await chatRepository.AddModeratorToChat(Context.User.Identity.Name, chatId);

            var users   = userRepository.Users.ToArray();
            var clients = users
                          .Where(user => permissionRepository.CheckPermission(user, "ChatModerating") || user.UserName == chat.UserName)
                          .Select(user => user.UserName)
                          .ToList();
            await Groups.AddToGroupAsync(chat.ModeratorName, GetChatName(chat.ChatId));

            await Clients.Users(clients).SendAsync("ModeratorSet", chat);
        }