public string AddComment(int issueId, string text) { if (this.Data.LoggedUser == null) { return "There is no currently logged in user"; } if (!this.Data.IssuesById.ContainsKey(issueId)) { return string.Format("There is no issue with ID {0}", issueId); } var issue = this.Data.IssuesById[issueId]; var comment = new Comment(this.Data.LoggedUser, text); issue.AddComment(comment); this.Data.CommentsByUser[this.Data.LoggedUser].Add(comment); return string.Format("Comment added successfully to issue {0}", issue.Id); }
public void AddComment(Comment comment) { this.Comments.Add(comment); }