public IEnumerable <Product> GetAllProduct(out int totalRecords, int currentPage = 1, int pageSize = 25, string sortBy = "Id", bool descending = true) { var spec = ProductQuery.WithAll(); totalRecords = _product.Count(spec); var sort = Context.Filters.Sort <Product, int>(ti => ti.Id, true); switch (sortBy) { case "Id": sort = Context.Filters.Sort <Product, int>(ti => ti.Id, descending); break; default: break; } var pager = Context.Filters.Page <Product>(currentPage, pageSize); return(_product.Find(spec, sort, pager)); }
public IEnumerable <Product> GetByAccountId(int accountId) { return(_product.Find(ProductQuery.WithByAccountId(accountId))); }
public Product GetByCode(string code) { return(_product.Find(ProductQuery.WithByCode(code)).FirstOrDefault()); }
public Product GetByProName(string proName) { return(_product.One(ProductQuery.WithByProName(proName))); }
public Product GetById(int id) { return(_product.One(ProductQuery.WithById(id))); }