public async Task <PagedResponse <TruckDto> > GetTrucks(PagingRequest paging = null) { var res = await _trucksBO.GetAll(paging : paging); var dtos = _mapper.Map <List <TruckDto> >(res.Records); return(PagedResponse <TruckDto> .Of(dtos, paging == null? 1 : paging.Page, res.TotalRecords)); }
public async Task <PagedResponse <ShipmentDto> > GetShipments(int truckId, PagingRequest paging) { if (truckId == 0) { throw new ArgumentNullException("TruckId is invalid"); } var res = await _shipmentsBO.GetByTruck(truckId, paging : paging); var dtos = _mapper.Map <List <ShipmentDto> >(res.Records); return(PagedResponse <ShipmentDto> .Of(dtos, paging == null? 1 : paging.Page, res.TotalRecords)); }