예제 #1
0
        public static List <SingleVideoDTO> ConvertLikedVideosToDTO(IEnumerable <Video> video)
        {
            List <SingleVideoDTO> singleVideoDTO = new List <SingleVideoDTO>();

            foreach (var v in video)
            {
                SingleVideoDTO newDTO = new SingleVideoDTO
                {
                    Id               = v.Id,
                    VideoUrl         = v.VideoUrl,
                    PhotoUrl         = v.PhotoUrl,
                    Name             = v.Name,
                    Description      = v.Description,
                    Visibility       = v.Visibility.ToString(),
                    Blocked          = v.Blocked,
                    Deleted          = v.Deleted,
                    AllowComments    = v.AllowComments,
                    AllowRaiting     = v.AllowRaiting,
                    NumberOfLikes    = v.NumberOfLikes,
                    NumberOfDislikes = v.NumberOfDislikes,
                    NumberOfViews    = v.NumberOfViews,
                    CreationDate     = v.CreationDate.ToString("dd.mm.yyyy"),
                    Owner            = UserForVideoComment.ConvertUserForVideoComment(v.Owner),
                    Comments         = CommentForVideoDTO.ConvertCommentToDTO(v.Comments)
                };
                singleVideoDTO.Add(newDTO);
            }
            return(singleVideoDTO);
        }
예제 #2
0
        public static List <CommentForVideoDTO> ConvertCommentToDTO(IEnumerable <Comment> comments)
        {
            List <CommentForVideoDTO> commentsDTO = new List <CommentForVideoDTO>();

            foreach (var comment in comments)
            {
                CommentForVideoDTO newDto = new CommentForVideoDTO
                {
                    Id               = comment.Id,
                    Description      = comment.Description,
                    CreationDate     = comment.CreationDate.ToString("dd.mm.yyyy"),
                    NumberOfLikes    = comment.NumberOfLikes,
                    NumberOfDislikes = comment.NumberOfDislikes,
                    User             = UserForVideoComment.ConvertUserForVideoComment(comment.User)
                };
                commentsDTO.Add(newDto);
            }

            return(commentsDTO);
        }
예제 #3
0
        public static SingleVideoDTO ConvertVideoToDTO(Video video)
        {
            SingleVideoDTO newDTO = new SingleVideoDTO
            {
                Id               = video.Id,
                VideoUrl         = video.VideoUrl,
                PhotoUrl         = video.PhotoUrl,
                Name             = video.Name,
                Description      = video.Description,
                Visibility       = video.Visibility.ToString(),
                Blocked          = video.Blocked,
                Deleted          = video.Deleted,
                AllowComments    = video.AllowComments,
                AllowRaiting     = video.AllowRaiting,
                NumberOfLikes    = video.NumberOfLikes,
                NumberOfDislikes = video.NumberOfDislikes,
                NumberOfViews    = video.NumberOfViews,
                CreationDate     = video.CreationDate.ToString("dd.mm.yyyy"),
                Owner            = UserForVideoComment.ConvertUserForVideoComment(video.Owner),
                Comments         = CommentForVideoDTO.ConvertCommentToDTO(video.Comments)
            };

            return(newDTO);
        }