Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }