public virtual ICollection FindByYear(int year) { SongList result = new SongList(); foreach (var song in songs) { if (song.song_year == year) { result.songs.Add(song); } } if (result.ToList().Count < 1) { return(null); } return(result); }
public static void FindBySongName(Catalog catalog, SearchQuery query) { if (query.song == null) { return; } List <ICollection> collections = new List <ICollection>(); if (query.result == null) { var song_names = catalog.songs_by_name.Keys.Where(x => x.Contains(query.song)); foreach (var song_name in song_names) { catalog.songs_by_name.TryGetValue(song_name, out SongList list); SongList col = (SongList)list.FindBySongName(query.song); if (col != null && col.ToList().Count > 0) { collections.Add(col); } } } else { foreach (var collection in query.result) { ICollection tmp = collection.FindBySongName(query.song); if (tmp != null && tmp.ToList().Count > 0) { collections.Add(tmp); } } } query.result = collections; if (query.result.Count == 0) { query.result = null; } }