public static Artist CreateOrLoadArtist(IRepository<Artist> artists, ArtistDetails artistDetails) { Artist artist = artists.Get(artistDetails.ID); if (artist != null) { return artist; } Artist newArtist = new Artist() { Name = artistDetails.Name, Country = artistDetails.Country, DateOfBirth = artistDetails.DateOfBirth }; artists.Add(newArtist); return newArtist; }
private static ArtistDetails ConvertToArtistDetails(ArtistModel artistModel) { ArtistDetails artistDetails = new ArtistDetails() { ID = artistModel.ID, Name = artistModel.Name, DateOfBirth = artistModel.DateOfBirth, Country = artistModel.Country }; return artistDetails; }
private static void AddSongs( ArtistDetails artistWithId2, ArtistDetails artistWithId3, SongsDataClient songsJsonDataClient, SongsDataClient songsXmlDataClient) { songsJsonDataClient.AddSong("Song 1", 2009, "Hip-Hop", new List<ArtistDetails>() { artistWithId2, artistWithId3 }, new List<AlbumDetails>()); songsJsonDataClient.AddSong("Song 2", 2011, "House", new List<ArtistDetails>() { artistWithId3 }, new List<AlbumDetails>()); songsXmlDataClient.AddSong("Song 3", 2009, "Trance", new List<ArtistDetails>() { artistWithId2 }, new List<AlbumDetails>()); songsXmlDataClient.AddSong("Song 4", 2009, "Pop", new List<ArtistDetails>() { artistWithId3 }, new List<AlbumDetails>()); songsXmlDataClient.AddSong("Song 5", 2009, "Rap", new List<ArtistDetails>() { artistWithId2 }, new List<AlbumDetails>()); }