public Task <bool> Handle(RemoveEmpregadoCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(false)); } _empregadoRepository.Remove(message.Id); if (Commit()) { Bus.RaiseEvent(new EmpregadoRemovedEvent(message.Id)); } return(Task.FromResult(true)); }
public void Remove(Guid id) { var removeCommand = new RemoveEmpregadoCommand(id); Bus.SendCommand(removeCommand); }