public Task <bool> Handle(CadastrarDocumentoCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(false)); } var cliente = _clienteRepository.GetById(message.ClienteId); if (cliente == null) { _bus.RaiseEvent(new DomainNotification(message.MessageType, "Cliente não cadastrado.", message)); return(Task.FromResult(false)); } var clienteDocumento = new ClienteDocumento(Guid.NewGuid(), message.FrenteBase64, message.VersoBase64, message.TipoDocumento, message.ClienteId); _clienteDocumentoRepository.Add(clienteDocumento); if (Commit()) { } return(Task.FromResult(true)); }
public void CadastrarDocumento(Guid clienteId, string frenteBase64, string versoBase64, int tipoDocumento) { var cadastrarDocumentoCommand = new CadastrarDocumentoCommand(clienteId, frenteBase64, versoBase64, (TipoDocumento)tipoDocumento); _bus.SendCommand(cadastrarDocumentoCommand); }