示例#1
0
        public void Operation(MainRequest chatData)
        {
            var       data         = chatData as GroupChatMessageModel;
            GroupChat newGroupChat = new GroupChat(data.GroupName);

            List <IClientModel> clients = new List <IClientModel>();

            clients.Add(_userClient);
            if (data.lsUsers.Count == 0)
            {
                return;
            }
            newGroupChat.AddManager(_userClient);
            newGroupChat.AddClient(_userClient);
            foreach (var clientName in data.lsUsers)
            {
                if (_allChatDetails.IsClientExist(clientName))
                {
                    IClientModel client = _allChatDetails.GetClientByName(clientName);
                    clients.Add(client);
                    newGroupChat.AddClient(client);
                }
            }

            if (!_allChatDetails.IsExistChatWithName(data.GroupName))
            {
                _allChatDetails.AddChat(newGroupChat);
                _containerInterfaces.Logger.LogInformation($"Group {data.GroupName} added");
            }
        }
示例#2
0
        public void Operation(MainRequest chatData)
        {
            var         data         = chatData as GroupChatMessageModel;
            GroupChat   newGroupChat = new GroupChat(data.GroupName);
            ClientModel senerClient  = _allChatDetails.GetClientByName(Name);

            List <ClientModel> clients = new List <ClientModel>();

            clients.Add(senerClient);
            if (data.lsUsers.Count == 0)
            {
                return;
            }
            newGroupChat.AddManager(senerClient);
            newGroupChat.AddClient(senerClient);
            foreach (var clientName in data.lsUsers)
            {
                if (_allChatDetails.IsClientExist(clientName))
                {
                    ClientModel client = _allChatDetails.GetClientByName(clientName);
                    clients.Add(client);
                    newGroupChat.AddClient(client);
                }
            }

            if (!_allChatDetails.IsExistChatWithName(data.GroupName))
            {
                _allChatDetails.AddChat(newGroupChat);
                Console.WriteLine($"Group {data.GroupName} added");
            }
        }