public int addThread(int forumId, int subForumId, int publisherId, string title, string body) { if ((title == null) || (title.Equals(""))) { throw new ArgumentException(error_emptyTitle); } lastMessageID++; int messageId = lastMessageID; Thread thread = new Thread(forumId, subForumId, messageId, publisherId, title, body); Message ms = thread.getMessage(); messages.Add(ms); return(ms.getMessageID()); }
private Message findMessage(int messageID) { bool found = false; int messagesSearched = 0; while ((!found) && (messagesSearched < messages.Count)) { Message cur = messages.ElementAt <Message>(messagesSearched); if (cur.getMessageID() == messageID) { found = true; return(cur); } messagesSearched++; } //if messageID is wrong return(null); }