Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public IEnumerable <Product> GetByAccountId(int accountId)
 {
     return(_product.Find(ProductQuery.WithByAccountId(accountId)));
 }
Exemplo n.º 3
0
 public Product GetByCode(string code)
 {
     return(_product.Find(ProductQuery.WithByCode(code)).FirstOrDefault());
 }
Exemplo n.º 4
0
 public Product GetByProName(string proName)
 {
     return(_product.One(ProductQuery.WithByProName(proName)));
 }
Exemplo n.º 5
0
 public Product GetById(int id)
 {
     return(_product.One(ProductQuery.WithById(id)));
 }