Example #1
0
 public async Task <bool> AddAsync(Vehicle vehicle)
 {
     using (IDbConnection connection = _vehiclesRepository.Connection)
     {
         return(await _vehiclesRepository.AddAsync(vehicle));
     }
 }
        public async Task HandleAsync(AddVehicle command)
        {
            var vehicle = new Vehicle(
                command.VehicleId,
                command.Brand,
                command.Model,
                command.Description,
                command.PayloadCapacity,
                command.LoadingCapacity,
                command.PricePerService,
                command.Variants);

            await _repository.AddAsync(vehicle);

            await _broker.PublishAsync(new VehicleAdded(command.VehicleId));
        }