예제 #1
0
        public async Task <bool> Handle(CreateRetailerCommand request, CancellationToken cancellationToken)
        {
            // Add new Retailer and add AddCreatedRetailerDomainEvent
            Retailer retailer = new Retailer(request.Name, request.Address);

            _retailerRepo.Add(retailer);

            // Publish integration event
            _eventBus.SendRetailer(retailer);

            // Save changes/Save changes async
            return(await _retailerRepo.SaveEntitiesAsync(cancellationToken));
        }