Example #1
0
        public Task <bool> Handle(RemoverEmpresaCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.FromResult(false));
            }

            _empresaRepository.Remove(message.Id);

            if (Commit())
            {
                Bus.RaiseEvent(new EmpresaRemovedEvent(message.Id));
            }

            return(Task.FromResult(true));
        }
Example #2
0
        public void Remove(Guid id)
        {
            var removeCommand = new RemoverEmpresaCommand(id);

            Bus.SendCommand(removeCommand);
        }