/// <summary> /// /// </summary> /// <param name="guid"></param> /// <returns></returns> public async Task <PatientJournal> GetPatientJournalById(Guid guid) { PatientJournal patientJournal = await TryCatch <ArgumentNullException, PatientJournal>(async() => { PatientJournal patientResult = await AerendeRepository.GetPatientJournalById(guid); return(patientResult); }); return(patientJournal); }
public static GetPatientJournalResponse WrapGetPatientJournalResponse(PatientJournal patientJournal) { GetPatientJournalResponse patientJournalResponse = new GetPatientJournalResponse() { PatientJournal = patientJournal, StatusCode = 200, Error = "No error", Description = "Returned patient journal matching the id.", Code = "no_error" }; return(patientJournalResponse); }
public GetPatientJournalResponse( PatientJournal _patientJournal, int _statusCode, string _error, string _description, string _code ) : base( _statusCode, _error, _description, _code ) { PatientJournal = _patientJournal; }
public async Task <IActionResult> GetPatientJournalById([FromQuery] Guid id) { if (!ModelState.IsValid) { BadRequest(ModelState); } if (id == Guid.Empty) { return(new JsonResult(await Errors .GetGenericErrorResponse( new GetPatientJournalResponse() { PatientJournal = new PatientJournal() { Id = id }, StatusCode = 400, Error = "Id can not be empty", Description = "Id can not be empty", Code = "id_can_not_be_empty" }))); } PatientJournal patientJournal = await _aerendeService.GetPatientJournalById(id); if (patientJournal == null) { return(new JsonResult(await Errors .GetGenericErrorResponse( new GetPatientJournalResponse() { PatientJournal = new PatientJournal() { Id = id }, StatusCode = 404, Error = "Patient journal not found", Description = "Patient journal could not be found", Code = "patentJournal_not_found" }))); } return(new JsonResult(Wrappyfier.WrapGetPatientJournalResponse(patientJournal))); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <PatientJournal> GetPatientJournalById(Guid id) { PatientJournal patientJournal = await _aerendeContext.GetPatientJournalById(id); return(patientJournal); }