public static CollectionResults <T> FindEntities <T>(this DbSet <T> Collection, string search, int start, int count, UniqueEntity.State state) where T : NamedEntity { var items = Collection.AsQueryable(); if (!string.IsNullOrEmpty(search)) { items = items.Where(f => f.Name.Contains(search)); } if (state == UniqueEntity.State.Active) { items = items.Where(f => f.Archived == false); } else if (state == UniqueEntity.State.Archived) { items = items.Where(f => f.Archived == true); } return(CollectionResults <T> .FromQueryable(items.OrderBy(f => f.Name), start, count)); }
public async Task <CollectionResults <Material> > Find(string search, int start, int count, UniqueEntity.State state) { return(Db.Material.FindEntities(search, start, count, state)); }