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

        return(new PhotoCategoryViewModel {
            Id = c.Id,
            Name = c.Name,
            Year = c.Year,
            CreateDate = DateTime.MinValue,
            Latitude = c.Latitude,
            Longitude = c.Longitude,
            PhotoCount = c.PhotoCount,
            TotalSizeXs = c.TotalSizeXs,
            TotalSizeXsSq = c.TotalSizeXsSq,
            TotalSizeSm = c.TotalSizeSm,
            TotalSizeMd = c.TotalSizeMd,
            TotalSizeLg = c.TotalSizeLg,
            TotalSizePrt = c.TotalSizePrt,
            TotalSizeSrc = c.TotalSizeSrc,
            TotalSize = c.TotalSize,
            TeaserImage = _adapter.Adapt(c.TeaserImage),
            TeaserImageSq = _adapter.Adapt(c.TeaserImageSq),
            Self = _urlSvc.GetCategoryUrl(c.Id),
            PhotosLink = _urlSvc.GetPhotosUrl(c.Id),
            DownloadLink = _urlSvc.GetCategoryDownloadUrl(c.Id),
            IsMissingGpsData = c.IsMissingGpsData
        });
    }
Exemple #2
0
    public MawApi.ViewModels.Photos.PhotoViewModel Adapt(Photo p)
    {
        if (p == null)
        {
            throw new ArgumentNullException(nameof(p));
        }

        return(new MawApi.ViewModels.Photos.PhotoViewModel {
            Id = p.Id,
            CategoryId = p.CategoryId,
            CreateDate = DateTime.MinValue,
            Latitude = p.Latitude,
            Longitude = p.Longitude,
            ImageXsSq = _adapter.Adapt(p.XsSqInfo, p.Id, "xs_sq"),
            ImageXs = _adapter.Adapt(p.XsInfo, p.Id, "xs"),
            ImageSm = _adapter.Adapt(p.SmInfo, p.Id, "sm"),
            ImageMd = _adapter.Adapt(p.MdInfo, p.Id, "md"),
            ImageLg = _adapter.Adapt(p.LgInfo, p.Id, "lg"),
            ImagePrt = _adapter.Adapt(p.PrtInfo, p.Id, "prt"),
            ImageSrc = _adapter.Adapt(p.SrcInfo, p.Id, "src"),
            Self = _urlSvc.GetPhotoUrl(p.Id),
            CategoryLink = _urlSvc.GetCategoryUrl(p.CategoryId),
            CommentsLink = _urlSvc.GetCommentsUrl(p.Id),
            ExifLink = _urlSvc.GetExifUrl(p.Id),
            RatingLink = _urlSvc.GetRatingUrl(p.Id)
        });
    }