public PagedCollection <Employee> Query(PagedCollectionQuery query) { if (query.Pagination == null) { query.Pagination = Pagination.Default; } if (query.Sorting == null || string.IsNullOrEmpty(query.Sorting.Property)) { query.Sorting = DefaultSorting; } var errors = query.Validate(new ValidationContext(query)); if (errors.Any()) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var items = _context.Persons; var pagedCollection = new PageFactory().GetPagedList(items, query); if (pagedCollection == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(pagedCollection); }
public PagedCollection <Employee> Query(PagedCollectionQuery query) { if (query == null) { throw new HttpResponseException(HttpStatusCode.BadRequest); } return(_employeeRepository.Query(query)); }