public async Task <IActionResult> PutPatientEHRAsync(Guid id, [FromBody] PatientEHR patient) { if (patient == null || id != patient.Id) { return(BadRequest()); } PatientEHR pt = await _patientEHRRecordService.FindAsync(id); if (pt == null) { return(NotFound()); } pt.ReasonForVisit = patient.ReasonForVisit; pt.VisitDateTime = patient.VisitDateTime; pt.DiagnosisCode = patient.DiagnosisCode; pt.DiagnosisDescription = patient.DiagnosisDescription; pt.LabName = patient.LabName; pt.LabValue = patient.LabValue; pt.LabUnits = patient.LabUnits; pt.LabDateTime = patient.LabDateTime; await _patientEHRRecordService.UpdateAsync(pt); return(new NoContentResult()); }
public Task AddAsync(PatientEHR patientRecord) { patientRecord.Id = Guid.NewGuid(); _context.PatientEHR.Add(patientRecord); _context.SaveChanges(); return(Task.CompletedTask); }
public async Task <IActionResult> PostPatientEHRAsync([FromBody] PatientEHR patient) { if (patient == null) { return(BadRequest()); } await _patientEHRRecordService.AddAsync(patient); return(CreatedAtRoute(nameof(GetPatientEHRByIdAsync), new { id = patient.Id }, patient)); }
public Task UpdateAsync(PatientEHR patientRecord) { try { _context.PatientEHR.Update(patientRecord); _context.SaveChanges(); } catch (Exception e) { } return(Task.CompletedTask); }
public async Task <IActionResult> GetPatientEHRByIdAsync(Guid id) { PatientEHR patient = await _patientEHRRecordService.FindAsync(id); if (patient == null) { return(NotFound()); } else { return(new ObjectResult(patient)); } }