Example #1
0
        public IEnumerable <Unit> GetAllUnit(out int totalRecords,
                                             int currentPage = 1,
                                             int pageSize    = 25,
                                             string sortBy   = "Id",
                                             bool descending = true,
                                             string name     = null)
        {
            var spec = UnitQuerry.WithAll();

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

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

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

            return(_unit.Find(spec, sort, pager));
        }
Example #2
0
 public TaxRate GetById(int id)
 {
     return(_taxRate.One(UnitQuerry.WithById(id)));
 }
Example #3
0
 public Unit GetById(int id)
 {
     return(_unit.One(UnitQuerry.WithById(id)));
 }