public Task Handle(RemoveFuncionarioCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.CompletedTask); } _funcionarioRepository.Remove(message.Id); if (Commit()) { Bus.RaiseEvent(new FuncionarioRemovedEvent(message.Id)); } return(Task.CompletedTask); }
public void Remove(Guid id) { var removeCommand = new RemoveFuncionarioCommand(id); Bus.SendCommand(removeCommand); }