Exemplo n.º 1
0
        public IDataResult <List <CommentDTO> > GetComments(Guid foodId)
        {
            var comments = _commentDAL.GetList(f => f.FoodID == foodId);
            List <CommentDTO> commentDTOs = new List <CommentDTO>();

            foreach (var comment in comments)
            {
                var cmtDto = new CommentDTO
                {
                    Comments       = comment,
                    CommentReplies = _commentDAL.GetCommentReplies(comment.ID)
                };
                commentDTOs.Add(cmtDto);
            }
            return(new SuccessDataResult <List <CommentDTO> >(commentDTOs));
        }