public List<Objects.Product> Get(Util.GridOptions options, ProductFiltering filter) { List<Objects.Product> lst = new List<Objects.Product>(); foreach (var p in context.Products.Where(x => x.CompanyId.Value == filter.CompanyId) .Where(filter.Filter()) .OrderBy(options.OrderBy, options.OrderDescending) .Skip(options.Skip) .Take(options.RowsPerPage)) lst.Add(new Objects.Product(p)); return lst; }
public int GetCount(ProductFiltering filter) { return context.Products.Where(x => x.CompanyId.Value == filter.CompanyId) .Where(filter.Filter()).Count(); }