/// <summary> /// Adding comment on Issue by provided Id /// </summary> /// <param name="issueId">Issue id</param> /// <param name="text">Comment text</param> /// <returns>Return different message with result of comment adding. Success or Not</returns> public string AddComment(int issueId, string text) { if (this.Data.CurrentUser == null) { return string.Format("There is no currently logged in user"); } if (!this.Data.IssuesById.ContainsKey(issueId)) { return string.Format("There is no issue with ID {0}", issueId + 1); } var issue = this.Data.IssuesById[issueId]; var comment = new Comment(this.Data.CurrentUser, text); issue.AddComment(comment); this.Data.UserComment[this.Data.CurrentUser].Add(comment); return string.Format("Comment added successfully to issue {0}", issue.Id); }
public void AddComment(Comment comment) { this.Comments.Add(comment); }