コード例 #1
0
ファイル: ServiceDataMapper.cs プロジェクト: dashluu/Blog
        public CommentDTO MapCommentEntityToDTO(CommentEntity commentEntity)
        {
            if (commentEntity == null)
            {
                return(null);
            }

            CommentDTO commentDTO = new CommentDTO()
            {
                CommentId   = commentEntity.CommentId,
                Username    = commentEntity.Username,
                Content     = commentEntity.Content,
                CreatedDate = commentEntity.CreatedDate
            };

            return(commentDTO);
        }
コード例 #2
0
ファイル: ServiceDataMapper.cs プロジェクト: dashluu/Blog
        public CommentEntity MapCommentDTOToEntity(CommentDTO commentDTO)
        {
            if (commentDTO == null)
            {
                return(null);
            }

            CommentEntity commentEntity = new CommentEntity()
            {
                CommentId       = commentDTO.CommentId,
                Username        = commentDTO.Username,
                Content         = commentDTO.Content,
                CreatedDate     = commentDTO.CreatedDate,
                ParentCommentId = commentDTO.ParentCommentId,
                PostId          = commentDTO.PostId
            };

            return(commentEntity);
        }