Exemplo n.º 1
0
        public virtual async Task <GResult <IEnumerable <TEntity> > > ReadAsync(MultiResultSpec <TEntity> spec)
        {
            var result = await _repository.GetAsync(spec);

            if (result != null || result?.Count > 0)
            {
                return(GResult <IEnumerable <TEntity> > .Success(result));
            }
            else
            {
                return(GResult <IEnumerable <TEntity> > .Failed(ErrorDescriber.NotFound()));
            }
        }
        public virtual async Task <IList <TEntity> > GetAsync(MultiResultSpec <TEntity> spec)
        {
            var result = await _dbContext.Set <TEntity>().Where(spec.ToExpression()).ToListAsync();

            return(result);
        }
        public async Task <IList <TEntity> > GetAsync(MultiResultSpec <TEntity> spec)
        {
            var result = await _collection.AsQueryable().Where(spec.ToExpression()).ToListAsync();

            return(result);
        }