public static CommentDTO ConvertCommentToDTO(Comment comment) { CommentDTO newDto = new CommentDTO { Id = comment.Id, Description = comment.Description, CreationDate = comment.CreationDate.ToString("dd.mm.yyyy"), NumberOfLikes = comment.NumberOfLikes, NumberOfDislikes = comment.NumberOfDislikes, User = UserForVideoComment.ConvertUserForVideoComment(comment.User), Video = VideoForUser.ConvertVideo(comment.Video) }; return(newDto); }
public static List <CommentDTO> ConvertCommenstToDTO(IEnumerable <Comment> comments) { List <CommentDTO> commentsDTO = new List <CommentDTO>(); foreach (var comment in comments) { CommentDTO newDto = new CommentDTO { Id = comment.Id, Description = comment.Description, CreationDate = comment.CreationDate.ToString("dd.mm.yyyy"), NumberOfLikes = comment.NumberOfLikes, NumberOfDislikes = comment.NumberOfDislikes, User = UserForVideoComment.ConvertUserForVideoComment(comment.User), Video = VideoForUser.ConvertVideo(comment.Video) }; commentsDTO.Add(newDto); } return(commentsDTO); }