Esempio n. 1
0
        public async Task HandleAsync(CreateLocationCommand command, ICorrelationContext context)
        {
            var location = new Location()
            {
                src_lat  = command.src_lat,
                src_long = command.src_long,
                des_lat  = command.des_lat,
                des_long = command.des_long,
            };
            await _locationRepository.CreateProductAsync(location);

            var result = _unitOfWork.SaveChanges();

            if (result > 0)
            {
                await _busPublisher.PublishAsync(new LocationCreatedEvent(
                                                     command.src_long,
                                                     command.src_lat,
                                                     command.des_long,
                                                     command.des_lat
                                                     ), context);
            }
        }