public async Task <IActionResult> GetPlcs([FromQuery] PlcParams plcsParams) { var plcsFromRepo = await _repo.GetPlcs(plcsParams); var plcs = _mapper.Map <IEnumerable <PlcForReturnDto> >(plcsFromRepo); Response.AddPagination(plcsFromRepo.CurrentPage, plcsFromRepo.PageSize, plcsFromRepo.TotalCount, plcsFromRepo.TotalPages); return(Ok(plcs)); }
public async Task <PagedList <Plc> > GetPlcs(PlcParams plcParams) { var plcs = _context.Plc.AsQueryable().OrderByDescending(p => p.Id); return(await PagedList <Plc> .CreateAsync(plcs, plcParams.PageNumber, plcParams.PageSize)); }