public async Task Remove(Guid?id) { var patientRemove = new RemovePatientCommand(id.Value); if (patientRemove == null) { throw new Exception($"Paciente não encontrado."); } await _mediator.Send(patientRemove); }
public Task <bool> Handle(RemovePatientCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return(Task.FromResult(false)); } _patientRepository.Remove(request.Id); if (Commit()) { _mediator.RaiseEvent(new PatientRemovedEvent(request.Id)); } return(Task.FromResult(true)); }
public void Remove(Guid id) { var removePatientCommand = new RemovePatientCommand(id); _mediator.SendCommand(removePatientCommand); }