private async Task <IEnumerable <Category> > GetCollection(FindCategories query) { if (query.Ids != null && query.Ids.Count() > 0) { return(await _categoryRepository.Where(x => query.Ids.Contains(x.Id)).ToListAsync()); } return(await _categoryRepository.ToListAsync()); }
public async Task <ActionResult <object> > GetAllCategories([FromQuery] FindCategories query) => await _categoriesService.FindAsync(query);
public async Task <ActionResult <IEnumerable <CategoryDto> > > GetCategories([FromQuery] FindCategories query) => Ok(await _dispatcher.QueryAsync(query));
public async Task <IEnumerable <CategoryDto> > HandleAsync(FindCategories query) { var categories = await GetCollection(query); return(categories.Select(x => _mapper.Map <CategoryDto>(x))); }