public GroupPatientResponse CreatePatients(Patient[] patients) { var body = patients; // new { patient }; GroupPatientResponse groupPatientResponse = new GroupPatientResponse(); var retpatients = GenericPost<GroupPatientResponse>("patient/batch", body); //mws: retPatients will be a "GroupPatientResponse" have "Patients" and "Errors" //mws: merge "Patient[] patients" with "retpatients" foreach (Patient patient in patients) { // org var newPatientId = (from p in retpatients.Patients where p.External_id == patient.External_id select p.Id).FirstOrDefault(); // This is Org. if (newPatientId > 0) { patient.Id = newPatientId; } } groupPatientResponse.Patients = patients.ToList(); groupPatientResponse.Errors = retpatients.Errors; return groupPatientResponse; }
public IndividualPatientResponse UpdatePatient(Patient patient) { var body = patient; IndividualPatientResponse individualPatientResponse = new IndividualPatientResponse(); Patient retPatient = GenericPut<Patient>(string.Format("patient/{0}", patient.Id), body); individualPatientResponse.Patient = patient; return individualPatientResponse; }
public IndividualPatientResponse CreatePatient(Patient patient) { var body = patient; // new { patient }; IndividualPatientResponse individualPatientResponse = new IndividualPatientResponse(); Patient retpatient = GenericPost<Patient>("patient", body); if (retpatient != null) { patient.Id = retpatient.Id; individualPatientResponse.Patient = patient; } return individualPatientResponse; }
public async Task<IndividualPatientResponse> UpdatePatientAsync(Patient patient) { var body = new { patient }; return await GenericPutAsync<IndividualPatientResponse>(string.Format("patients/{0}.json", patient.Id), body); }
public async Task<IndividualPatientResponse> CreatePatientAsync(Patient patient) { var body = new { patient }; return await GenericPostAsync<IndividualPatientResponse>("patients.json", body); }