Пример #1
0
        public IEnumerable <CustomerInvoice> GetAllCustomerInvoice(out int totalRecords,
                                                                   int currentPage            = 1,
                                                                   int pageSize               = 25,
                                                                   string sortBy              = "Id",
                                                                   bool descending            = true,
                                                                   string customerInvoiceName = null,
                                                                   string companyCode         = null)
        {
            var spec = CustomerInvoiceQuery.WithAll();

            totalRecords = _customerInvoice.Count(spec);
            var sort = Context.Filters.Sort <CustomerInvoice, int>(ti => ti.Id, true);

            switch (sortBy)
            {
            case "Id":
                sort = Context.Filters.Sort <CustomerInvoice, int>(ti => ti.Id, descending);
                break;

            default:
                break;
            }
            var pager = Context.Filters.Page <CustomerInvoice>(currentPage, pageSize);

            return(_customerInvoice.Find(spec, sort, pager));
        }
Пример #2
0
 public CustomerInvoice GetByCompanyCode(string companyCode)
 {
     return(_customerInvoice.One(CustomerInvoiceQuery.WithByCompanyCode(companyCode)));
 }
Пример #3
0
 public CustomerInvoice GetById(int id)
 {
     return(_customerInvoice.One(CustomerInvoiceQuery.WithById(id)));
 }