public override IOrderedQueryable <T> GetItemLinqQueryable <T>(bool allowSynchronousQueryExecution = false, string continuationToken = null, QueryRequestOptions requestOptions = null) { var r = new EnumerableQuery <T>(Enumerable.Empty <T>()); var returnValue = r.OrderBy(_ => _); return(returnValue); }
public IEnumerable <Band> Search(BandSearchInformation bandSearchInformation, out int totalMatches) { using (var context = new MusicArchiveContext()) { IQueryable <Band> matches = new EnumerableQuery <Band>(context.Bands); if (!string.IsNullOrWhiteSpace(bandSearchInformation.BandName)) { matches = matches.Where(b => b.Name.Contains(bandSearchInformation.BandName)); } if (!string.IsNullOrWhiteSpace(bandSearchInformation.CountryOfOrigin)) { matches = matches.Where(band1 => band1.CountryOfOrgin == bandSearchInformation.CountryOfOrigin); } if (!string.IsNullOrWhiteSpace(bandSearchInformation.Genre)) { matches = matches.Where(band1 => band1.Genre == bandSearchInformation.Genre); } if (!string.IsNullOrWhiteSpace(bandSearchInformation.Label)) { //matches = matches.Where(band1 => band1.CurrentLabel == bandSearchInformation.Label); } if (!string.IsNullOrWhiteSpace(bandSearchInformation.YearOfFormation)) { matches = matches.Where(band1 => band1.FormedIn == bandSearchInformation.YearOfFormation); //TODO make this an actual date... } if (!string.IsNullOrWhiteSpace(bandSearchInformation.LyricalThemes)) { matches = matches.Where(band1 => band1.LyricalThemes == bandSearchInformation.LyricalThemes); } totalMatches = matches.Count(); return(matches.OrderBy(band => band.Name).Skip(bandSearchInformation.StartingRecordNumber).Take(bandSearchInformation.PageSize).ToList()); } }