public async Task <IActionResult> GetShippers([FromQuery] ShipperParams shipperParams) { var shippers = await _repo.GetShippers(shipperParams); var shippersToReturn = _mapper.Map <IEnumerable <ShipperReturnDTO> >(shippers); Response.AddPagination(shippers.CurrentPage, shippers.PageSize, shippers.TotalCount, shippers.TotalPages); return(Ok(shippersToReturn)); }
public async Task <PagedList <Shipper> > GetShippers(ShipperParams shipperParams) { var shippers = _context.Shippers.Include(o => o.Orders).AsQueryable(); shippers = shippers.Where(f => (f.CompanyName == shipperParams.CompanyName || f.Phone == shipperParams.Phone)); return(await PagedList <Shipper> .CreateAsync(shippers, shipperParams.PageNumber, shipperParams.PageSize)); }