paginationaspnetboilerplate

Is there any sample code to check PagedResultDto in asp.net boilerplate


I am trying to override getall method but i am getting this error

Severity Code Description Project File Line Suppression State Error CS7036 There is no argument given that corresponds to the required formal parameter 'items' of 'PagedResultDto.PagedResultDto(int, IReadOnlyList)' fs.Application C:\Projects\fs\3.2\aspnet-core\src\fs.Application\Location\StateService.cs 35 Active

This is my code

public override Task<PagedResultDto<StateDto>> GetAll(PagedResultRequestDto input)
        {
            var query = _repository.GetAll();
            var statelist = query.Skip(input.SkipCount).Take(input.MaxResultCount).ToList();
            return new PagedResultDto<StateDto>(ObjectMapper.Map<List<StateDto>>(statelist));
        }

Solution

  • You need to pass the totalCount parameter:

    new PagedResultDto<StateDto>(query.Count(), ObjectMapper.Map<List<StateDto>>(statelist));
    

    Cannot implicitly convert type 'Abp.Application.Services.Dto.PagedResultDto' to 'System.Threading.Tasks.Task>‌​' fs.Application C:\‌​Projects\fs\3.2\aspn‌​et-core\src\fs.Appli‌​cation\Location\Stat‌​eService.cs 36

    Wrap result in a Task like this:

    var result = new PagedResultDto<StateDto>(...);
    return Task.FromResult(result);