private async Task <bool> CarAmountIsValid(OrderFromStockCreateCommand command, CancellationToken cancellationToken) { var query = await ReadRepository.GetQueryableAsync(_carStockFiltersProvider.ById(command.CarId)); var amount = query.Select(x => x.Amount).FirstOrDefault(); return(amount >= 1); }
private async Task <bool> CarExists(int id, CancellationToken cancellationToken) { return(await Task.Run(() => ReadRepository.ValidateExists(_carStockFiltersProvider.ById(id)), cancellationToken)); }