public static Song CreateOrLoadSong(IRepository<Song> songs, SongDetails songDetails) { Song song = songs.Get(songDetails.ID); if (song != null) { return song; } Song newSong = new Song() { Title = songDetails.Title, Genre = songDetails.Genre, Year = songDetails.Year }; songs.Add(newSong); return newSong; }
private static SongDetails ConvertToSongDetails(SongModel songModel) { SongDetails songDetails = new SongDetails() { ID = songModel.ID, Title = songModel.Title, Genre = songModel.Genre, Year = songModel.Year }; return songDetails; }