Exemple #1
0
        public static CommentDto ConvertToCommentDto(Comments comment)
        {
            CommentDto newCommentDto = new CommentDto();
            if (comment != null)
            {
                newCommentDto.Content = comment.Content;
                newCommentDto.Name = comment.Name;
                newCommentDto.Phone = comment.Phone;
                newCommentDto.Title = comment.Title;
                newCommentDto.ProductId = comment.Product.Id;
                newCommentDto.CreatedDate = ((comment.CreatedDate != null) ? (DateTime)comment.CreatedDate : DateTime.Now);
            }
            else return null;

            return newCommentDto;
        }
Exemple #2
0
 public static Comments ConvertToComments(CommentDto commentDto)
 {
     Comments comments = new Comments();
     if (commentDto != null)
     {
         comments.Title = commentDto.Title;
         comments.Status = StatusDAO.getStatusById(CONST.STATUS.ACTIVE);
         comments.Product = ProductDAO.getProductById(commentDto.ProductId);
         comments.Phone = commentDto.Phone;
         comments.Name = commentDto.Name;
         comments.Email = commentDto.Email;
         comments.CreatedDate = DateTime.Now;
         comments.Content = commentDto.Content;
     }
     return comments;
 }