コード例 #1
0
 public static Album From(AlbumJson json)
 {
     if (json != null)
     {
         return(new Album()
         {
             AlbumId = json.AlbumId,
             GenreId = json.GenreId,
             ArtistId = json.ArtistId,
             Title = json.Title,
             Price = json.Price,
             AlbumArtUrl = json.AlbumArtUrl,
             Created = json.Created,
             OrderCount = json.OrderCount,
             Artist = Artist.From(json.Artist),
             Genre = Genre.From(json.Genre)
         });
     }
     else
     {
         return(new Album()
         {
             AlbumId = 0,
             Title = "Unknown",
         });
     }
 }
コード例 #2
0
        public static List <AlbumJson> From(List <Album> albums)
        {
            List <AlbumJson> results = new List <AlbumJson>();

            if (albums == null)
            {
                return(results);
            }
            foreach (Album a in albums)
            {
                results.Add(AlbumJson.From(a));
            }
            return(results);
        }
コード例 #3
0
        public static AlbumJson From(Album album)
        {
            var result = new AlbumJson()
            {
                AlbumId     = album.AlbumId,
                GenreId     = album.GenreId,
                ArtistId    = album.ArtistId,
                Title       = album.Title,
                Price       = album.Price,
                AlbumArtUrl = album.AlbumArtUrl,
                Created     = album.Created,
                OrderCount  = album.OrderCount,
                Artist      = ArtistJson.From(album.Artist),
                Genre       = GenreJson.From(album.Genre)
            };

            return(result);
        }