示例#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 SingleUserDTO ConvertUserToDTO(User user)
        {
            RoleType      role    = (RoleType)user.Role;
            SingleUserDTO newVDTO = new SingleUserDTO
            {
                Id = user.Id,
                profilePictureUrl = user.ProfilePictureUrl,
                Username          = user.Username,
                Password          = user.Password,
                FirstName         = user.FirstName,
                LastName          = user.LastName,
                Email             = user.Email,
                Description       = user.Description,
                RegistrationDate  = user.RegistrationDate.ToString("dd.mm.yyyy"),
                Role          = role.ToString(),
                Blocked       = user.Blocked,
                UsersVideos   = VideoForUser.ConvertVideoToDTO(user.UserVideos),
                LikedVideos   = SingleVideoDTO.ConvertLikedVideosToDTO(user.LikedVideos),
                UserComments  = CommentForUserDTO.ConvertCommentToDTO(user.UserComments),
                LikedComments = CommentForUserDTO.ConvertCommentToDTO(user.LikedComments),
                Followers     = UserForVideoComment.ConvertFollowers(user.Followers),
                Following     = UserForVideoComment.ConvertFollowers(user.Following)
            };

            return(newVDTO);
        }
示例#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);
        }