示例#1
0
        public IActionResult GetFlaggedComments(int id, int skip, int take)
        {
            IEnumerable <Comment> flaggedComments = _ideationManager.GetFlaggedComments(id, skip, take);
            List <CommentDTO>     comments        = new List <CommentDTO>();

            foreach (Comment comment in flaggedComments)
            {
                CommentDTO commentDto = new CommentDTO()
                {
                    CommentId    = comment.CommentId,
                    CommentText  = comment.CommentText,
                    DateTime     = comment.Created.FormatParasableDate(),
                    UserFullName = comment.User.GetFullName(),
                    UserName     = comment.User.UserName,
                    Reports      = new List <ReportDTO>()
                };
                foreach (Report report in comment.Reports)
                {
                    ReportDTO newReport = new ReportDTO()
                    {
                        Reason       = report.Reason,
                        ReportId     = report.ReportId,
                        UserFullName = report.User.GetFullName()
                    };
                    commentDto.Reports.Add(newReport);
                }
                comments.Add(commentDto);
            }

            return(Ok(comments));
        }