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); }
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); }