public Common.OperationResults.OperationResult FederarPaciente(int pacienteId) { var op = new OperationResult(); try { var entity = CurrentContext.DataContext.Pacientes.Find(pacienteId); var request = new Fhir.Model.Request.FederarPacienteRequest { DNI = entity.NroDocumento, FechaNacimiento = entity.FechaNacimiento, Sexo = entity.Sexo == "M" ? Sexo.Masculino : Sexo.Femenido, LocalId = entity.Id.ToString(), PrimerNombre = entity.PrimerNombre, PrimerApellido = entity.PrimerApellido, OtrosNombres = entity.OtrosNombres }; var resp = _patientManager.FederarPaciente(request); if (resp.Id.HasValue) { entity.FederadoDateTime = DateTime.Now; entity.FederadorId = resp.Id.Value; CurrentContext.DataContext.SaveChanges(); op.Id = resp.Id.Value; } else { op.AddError("El Federador no ha devuelto resultados."); } } catch (Exception ex) { var strError = $"Error registrando Paciente en el BUS: {ex.Message}"; op.AddError(strError); Logger.LogError(ex, strError); } return op; }