Exemplo n.º 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);
        }
Exemplo n.º 2
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);
        }