public VideoCategoryViewModel Adapt(Category c)
    {
        if (c == null)
        {
            throw new ArgumentNullException(nameof(c));
        }

        return(new VideoCategoryViewModel {
            Id = c.Id,
            Name = c.Name,
            Year = c.Year,
            CreateDate = DateTime.MinValue,
            Latitude = c.Latitude,
            Longitude = c.Longitude,
            VideoCount = c.VideoCount,
            TotalDuration = c.TotalDuration,
            TotalSizeThumbnail = c.TotalSizeThumbnail,
            TotalSizeThumbnailSq = c.TotalSizeThumbnailSq,
            TotalSizeScaled = c.TotalSizeScaled,
            TotalSizeFull = c.TotalSizeFull,
            TotalSizeRaw = c.TotalSizeRaw,
            TotalSize = c.TotalSize,
            TeaserImage = _adapter.Adapt(c.TeaserImage),
            TeaserImageSq = _adapter.Adapt(c.TeaserImageSq),
            Self = _urlSvc.GetCategoryUrl(c.Id),
            VideosLink = _urlSvc.GetVideosUrl(c.Id),
            IsMissingGpsData = c.IsMissingGpsData
        });
    }
示例#2
0
    public MawApi.ViewModels.Videos.VideoViewModel Adapt(Video v)
    {
        if (v == null)
        {
            throw new ArgumentNullException(nameof(v));
        }

        return(new MawApi.ViewModels.Videos.VideoViewModel {
            Id = v.Id,
            CategoryId = v.CategoryId,
            CreateDate = DateTime.MinValue,
            Latitude = v.Latitude,
            Longitude = v.Longitude,
            Duration = v.Duration,
            Thumbnail = _adapter.Adapt(v.Thumbnail),
            ThumbnailSq = _adapter.Adapt(v.ThumbnailSq),
            VideoScaled = _adapter.Adapt(v.VideoScaled),
            VideoFull = _adapter.Adapt(v.VideoFull),
            VideoRaw = _adapter.Adapt(v.VideoRaw),
            Self = _urlSvc.GetVideoUrl(v.Id),
            CategoryLink = _urlSvc.GetCategoryUrl(v.CategoryId),
            CommentsLink = _urlSvc.GetCommentsUrl(v.Id),
            RatingLink = _urlSvc.GetRatingUrl(v.Id)
        });
    }