Exemple #1
0
        public static List <VideoDTO> ConvertVideosToDTO(IEnumerable <Video> videos)
        {
            List <VideoDTO> videosDto = new List <VideoDTO>();

            foreach (var video in videos)
            {
                VideoDTO newVDTO = new VideoDTO
                {
                    Id               = video.Id,
                    VideoUrl         = video.VideoUrl,
                    PhotoUrl         = video.PhotoUrl,
                    Name             = video.Name,
                    Description      = video.Description,
                    Visibility       = video.Visibility,
                    Blocked          = video.Blocked,
                    AllowComments    = video.AllowComments,
                    AllowRaiting     = video.AllowRaiting,
                    NumberOfLikes    = video.NumberOfLikes,
                    NumberOfDislikes = video.NumberOfDislikes,
                    NumberOfViews    = video.NumberOfViews,
                    CreationDate     = video.CreationDate.ToString("dd.mm.yyyy"),
                    User             = UserForVideoComment.ConvertUserForVideoComment(video.Owner)
                };
                videosDto.Add(newVDTO);
            }
            return(videosDto);
        }
Exemple #2
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);
        }
Exemple #3
0
        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 <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);
        }
Exemple #5
0
        public static VideoDTO ConvertVideoToDTO(Video video)
        {
            VideoDTO newVDTO = new VideoDTO
            {
                Id               = video.Id,
                VideoUrl         = video.VideoUrl,
                PhotoUrl         = video.PhotoUrl,
                Name             = video.Name,
                Description      = video.Description,
                Visibility       = video.Visibility,
                Blocked          = video.Blocked,
                AllowComments    = video.AllowComments,
                AllowRaiting     = video.AllowRaiting,
                NumberOfLikes    = video.NumberOfLikes,
                NumberOfDislikes = video.NumberOfDislikes,
                NumberOfViews    = video.NumberOfViews,
                CreationDate     = video.CreationDate.ToString("dd.mm.yyyy"),
                User             = UserForVideoComment.ConvertUserForVideoComment(video.Owner)
            };

            return(newVDTO);
        }
Exemple #6
0
        public static LikeCommentDTO ConvertCommentToDTO(LikeDislikeComment likeDislikeComment)
        {
            string likeDislike = "";

            if (likeDislikeComment.LikeOrDislike == true)
            {
                likeDislike = "Like";
            }
            else
            {
                likeDislike = "false";
            }
            LikeCommentDTO newDto = new LikeCommentDTO
            {
                Id            = likeDislikeComment.Id,
                LikeOrDislike = likeDislike,
                CreationDate  = likeDislikeComment.CreationDate.ToString("dd.mm.yyyy"),
                Owner         = UserForVideoComment.ConvertUserForVideoComment(likeDislikeComment.Owner),
                Comment       = CommentForUserDTO.SingleConvertCommentToDTO(likeDislikeComment.Comment)
            };

            return(newDto);
        }