public Task Handle(SoftRemoveCustomerCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.CompletedTask);
            }



            _customerRepository.SoftRemove(message.Id);

            if (Commit())
            {
                var existingCustomer = _customerRepository.GetById(message.Id);

                Bus.RaiseEvent(new CustomerUpdatedEvent(existingCustomer.Id, existingCustomer.Name, existingCustomer.IsActive));
            }

            return(Task.CompletedTask);
        }
Beispiel #2
0
        public void SoftRemove(Guid id)
        {
            var softRemoveCommand = new SoftRemoveCustomerCommand(id);

            Bus.SendCommand(softRemoveCommand);
        }