public IEnumerable <RawMaterialPurchase> GetRawMaterialPurchases(int PageNumber, int ResultsPerPage = Int32.MaxValue, string search = null) { return(RawMaterialPurchase .Where(e => search == null || e.RawMaterial.MaterialName == search) .Include(e => e.RawMaterial) .OrderBy(e => e.RawMaterial.MaterialName) .ThenByDescending(e => e.DateRecieved) .Skip(ResultsPerPage * (PageNumber - 1)) .Take(ResultsPerPage)); }
public int CountRawMaterialPurchases(string search = null) { return(RawMaterialPurchase .Where(e => search == null || e.RawMaterial.MaterialName == search) .Count()); }