コード例 #1
0
        public List <CommentDTO> GetCommentsForEvent(int EventID)
        {
            var CommentList = db.Comments
                              .Where(comment => comment.EventID == EventID)
                              .OrderBy(comment => comment.Date)
                              .ToList();
            List <CommentDTO> CommentDTOs = new List <CommentDTO>();

            foreach (Comment comment in CommentList)
            {
                CommentDTO CommentDTO = CommentMapper.Comment2CommentDTO(comment);
                CommentDTOs.Add(CommentDTO);
            }
            return(CommentDTOs);
        }