THANK YOU VERY MUCH.
but i have compile Error in this way:
public async Task<PagedResultDto<ProvinceListDto>> GetProvinces(GetProvincesInput input)
{
var query = _provinceRepository
.WhereIf
!input.Filter.IsNullOrWhiteSpace(),
p =>
p.Name.Contains(input.Filter)
);
var provinceCount = await query.CountAsync();
var provinces = await query
.OrderBy(input.Sorting)
.PageBy(input)
.ToListAsync();
var provinceListDtos = ObjectMapper.Map<List<ProvinceListDto>>(provinces);
return new PagedResultDto<ProvinceListDto>(
provinceCount,
provinceListDtos
);
}
hi, i want get all record count for Grid Paging like this command " var provinceCount = await query.CountAsync();" but when write method
public class ProvinceAppService : ResourceAssessmentsNetworkAppServiceBase, IProvinceAppService
{
public IAsyncQueryableExecuter AsyncQueryableExecuter { get; set; }
private readonly IRepository<Province> _provinceRepository;
public ProvinceAppService(IRepository<Province> provinceRepository)
{
_provinceRepository = provinceRepository;
AsyncQueryableExecuter = NullAsyncQueryableExecuter.Instance;
}
public async Task<PagedResultDto<ProvinceListDto>> GetProvinces(GetProvincesInput input)
{
var query = _provinceRepository
**<span style="color:#BF0000"> .WhereIf(</span>**
!input.Filter.IsNullOrWhiteSpace(),
p =>
p.Name.Contains(input.Filter)
);
var provinceCount = await query.CountAsync();
var provinces = await query
.OrderBy(input.Sorting)
.PageBy(input)
.ToListAsync();
var provinceListDtos = ObjectMapper.Map<List<ProvinceListDto>>(provinces);
return new PagedResultDto<ProvinceListDto>(
provinceCount,
provinceListDtos
);
}
{
I have error in ".WhereIf" <ins>'IRepository<Province>' does not contain a definition for 'WhereIf' and no extension method 'WhereIf' accepting a first argument of type 'IRepository<Province>' could be found (are you missing a using directive or an assembly reference?)</ins>
I forced to write this method as follows:
public class ProvinceAppService : ResourceAssessmentsNetworkAppServiceBase, IProvinceAppService
{
public IAsyncQueryableExecuter AsyncQueryableExecuter { get; set; }
private readonly IRepository<Province> _provinceRepository;
public ProvinceAppService(IRepository<Province> provinceRepository)
{
_provinceRepository = provinceRepository;
AsyncQueryableExecuter = NullAsyncQueryableExecuter.Instance;
}
public async Task<PagedResultDto<ProvinceListDto>> GetProvinces(GetProvincesInput input)
{
var query = _provinceRepository
.GetAll()
.WhereIf(
!input.Filter.IsNullOrWhiteSpace(),
p =>
p.Name.Contains(input.Filter)
);
var provinceCount = await query.CountAsync();
var query1 = _provinceRepository
.GetAll()
.WhereIf(
!input.Filter.IsNullOrWhiteSpace(),
p =>
p.Name.Contains(input.Filter)
)
.OrderBy(p => input.Sorting)
.PageBy(input);
var provinces = await AsyncQueryableExecuter.ToListAsync(query1);
var provinceListDtos = ObjectMapper.Map<List<ProvinceListDto>>(provinces);
return new PagedResultDto<ProvinceListDto>(
provinceCount,
provinceListDtos
);
}
}
How can I fix this problem? Is there a better way?
Server and client-side files are attached. ServerSideCode.rar ClientSideCode.rar
yes, this is startead to happend after i add Province.component.html,Province.component.ts. this files are attached in main.rar
I've run, but the problem has notbeen resolved!
hi, I corrected some of the problems, but I can not bind data to the grid. And I can not find the problem. I tried to implement (Province.component.html,Province.component.ts) such as Usersforms(users.component.html, users.component.ts).
I have attached the relevant codes.
Of course I know that this problem is not related to Abp and is related to Angular, but I'm glad to help me. thanks. main.rar
I did it, but the problem did not fix!
How to inject IAsyncQueryableExecuter and do?