public async Task <int> GetCountAsync(MessageQueryModel query, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(query.ApiRoute)) { return(await Task.FromResult(_entities.Count)); } return(await Task.FromResult(_entities.Count(e => e.ApiRoute.StartsWith(query.ApiRoute)))); }
public async Task <PageResultDto <RouteRoleEntity> > GetAsync(MessageQueryModel query, CancellationToken cancellationToken = default) { var result = new PageResultDto <RouteRoleEntity>(); if (string.IsNullOrWhiteSpace(query.ApiRoute)) { result.Count = _entities.Count; result.Items = _entities; } result.Count = await GetCountAsync(query, cancellationToken); result.Items = _entities.Where(e => e.ApiRoute.StartsWith(query.ApiRoute)).ToList(); return(await Task.FromResult(result)); }