private bool QueryIsEmpty(ProgQuery query) { return(string.IsNullOrWhiteSpace(query.Artist) && string.IsNullOrWhiteSpace(query.MonthYear) && string.IsNullOrWhiteSpace(query.Cover) && string.IsNullOrWhiteSpace(query.Year)); }
public IPagedList <ProgInfo> FindProgs(ProgQuery query) { List <ProgInfo> progs; //nearly forgot to handle the degenerate case. If we don't have any query parameters, return everything if (QueryIsEmpty(query)) { progs = progStore .GetAllProgs() .OrderBy(prog => prog.Prog) .ToList(); } else { progs = progStore.GetProgsByArtist(query.Artist) .Concat(progStore.GetProgsByMonthYear(query.MonthYear)) .Concat(progStore.GetProgsByCover(query.Cover)) .Concat(progStore.GetProgsByYear(query.Year)) .DistinctBy(prog => prog.Prog) .OrderBy(prog => prog.Prog) .ToList(); } return(progs.ToPagedList(query.Page, query.PageSize)); }