Пример #1
0
        public async Task Handle(RemoveSuperpowerCommand notification, CancellationToken cancellationToken)
        {
            if (!notification.IsValid())
            {
                NotifyValidationErrors(notification);
                return;
            }

            _superpowerRepository.Remove(notification.Id);

            if (await CommitAsync())
            {
                var superpowerEvent = new SuperpowerRemovedEvent(notification.Id);
                await _bus.RaiseEvent(superpowerEvent);
            }
        }
 public async Task Remove(Guid id)
 {
     var removeCommand = new RemoveSuperpowerCommand(id);
     await _bus.SendCommand(removeCommand);
 }