public async Task <bool> DeleteAsync(int id) { using (IDbConnection connection = _vehiclesRepository.Connection) { return(await _vehiclesRepository.DeleteAsync(id)); } }
public async Task HandleAsync(DeleteVehicle command) { var vehicle = await _repository.GetAsync(command.Id); if (vehicle is null) { throw new VehicleNotFoundException(command.Id); } await _repository.DeleteAsync(vehicle); await _broker.PublishAsync(new VehicleDeleted(command.Id)); }