Пример #1
0
        public void AddMessageToLog(int roomId, string sender, string message)
        {
            ChatRoomLog log = chatRoomLogs.Find(x => x.roomId == roomId).Single();

            log.AddMessage(sender, message);

            chatRoomLogs.ReplaceOne(x => x.roomId == roomId, log);
        }
Пример #2
0
        public ChatRoomLog CreateChatRoomLog(int roomId)
        {
            var chatRoomsList = chatRoomLogs.Find(x => x.roomId == roomId).ToList();

            if (chatRoomsList.Count == 1)
            {
                return(chatRoomsList[0]);
            }

            ChatRoomLog chatRoomLog = new ChatRoomLog(roomId);

            chatRoomLogs.InsertOne(chatRoomLog);

            return(chatRoomLog);
        }