public static Album CreateOrLoadAlbum(IRepository<Album> albums, AlbumDetails albumDetails) { Album album = albums.Get(albumDetails.ID); if (album != null) { return album; } Album newAlbum = new Album() { Title = albumDetails.Title, Producer = albumDetails.Producer, Year = albumDetails.Year }; albums.Add(newAlbum); return newAlbum; }
private static AlbumDetails ConvertToAlbumDetails(AlbumModel albumModel) { AlbumDetails albumDetails = new AlbumDetails() { ID = albumModel.ID, Title = albumModel.Title, Producer = albumModel.Producer, Year = albumModel.Year }; return albumDetails; }