コード例 #1
0
        public Article GetArticleById(int id)
        {
            var article = articleDataAccess.GetArticleById(id);

            if (article != null)
            {
                var comments = commentDataAccess.GetArticleComments(id);
                article.Comments = new List <Comment>();
                foreach (var comment in comments)
                {
                    if (!comment.ParentId.HasValue)
                    {
                        article.Comments.Add(commentDataAccess.RetriveComments(comment));
                    }
                }
                return(article);
            }
            return(null);
        }