Пример #1
0
        public static ArtistJson From(Artist artist)
        {
            var result = new ArtistJson()
            {
                ArtistId = artist.ArtistId,
                Name     = artist.Name
            };

            return(result);
        }
Пример #2
0
        public static List <ArtistJson> From(List <Artist> artists)
        {
            List <ArtistJson> results = new List <ArtistJson>();

            if (artists == null)
            {
                return(results);
            }

            foreach (Artist a in artists)
            {
                results.Add(ArtistJson.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);
        }
Пример #4
0
 public static Artist From(ArtistJson artist)
 {
     if (artist != null)
     {
         return(new Artist()
         {
             ArtistId = artist.ArtistId,
             Name = artist.Name
         });
     }
     else
     {
         return(new Artist()
         {
             ArtistId = 0,
             Name = "Unknown"
         });
     }
 }