public async Task <IEnumerable <Unit> > Handle(GetAllUnitsQuery request, CancellationToken cancellationToken) { return(await _context.Units.AsQueryable().AsNoTracking().ToListAsync(cancellationToken)); }
public async Task <List <GetUnitResponse> > Handle(GetAllUnitsQuery request, CancellationToken cancellationToken) { var units = await _unitService.GetAllAsync(cancellationToken); return(units.Select(x => _mapper.Map <Unit, GetUnitResponse>(x)).ToList()); }