public HttpResponseMessage Read(int patientId, string _format = "application/xml+FHIR", bool _summary = false) { HttpResponseMessage message = new HttpResponseMessage(); Patient patient = db.Patients.Find(patientId); if (patient == null) { message.StatusCode = HttpStatusCode.NotFound; message.Content = new StringContent("Patient with id " + patientId + " not found!", Encoding.UTF8, "text/html"); return(message); } Hl7.Fhir.Model.Patient fhirPatient = PatientMapper.MapModel(patient); string fixedFormat = ControllerUtils.FixMimeString(_format); string payload = ControllerUtils.Serialize(fhirPatient, fixedFormat, _summary); message.Content = new StringContent(payload, Encoding.UTF8, fixedFormat); return(message); }