Ejemplo n.º 1
0
        public async Task <IActionResult> GetPatientJournalById([FromQuery] Guid id, [FromHeader] string authorization)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id == Guid.Empty)
            {
                return(new JsonResult(new { error = "error" }));
            }

            HttpParameters httpParameters =
                HttpParametersService.GetHttpParameters(
                    null,
                    ConfigHelper.AppSetting(AerendeConstants.ServerUrls, AerendeConstants.GetPatientJournalById),
                    HttpMethod.Get,
                    id.ToString(),
                    authorization
                    );

            GetPatientJournalResponse patientJournalResponse = await _aerendeService.Get <GetPatientJournalResponse>(httpParameters);

            return(new JsonResult(patientJournalResponse));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetPatientJournalById(Guid id, [FromHeader] string authorization)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id == Guid.Empty)
            {
                return(BadRequest("id can not be empty"));
            }

            HttpParameters httpParameters =
                HttpParametersService.GetHttpParameters(
                    null,
                    ConfigHelper.AppSetting(Constants.ServerUrls, Constants.GetPatientJournalById),
                    HttpMethod.Get,
                    id.ToString(),
                    authorization
                    );

            GetPatientJournalResponse patientJournalResult = await _gWService.Get <GetPatientJournalResponse>(httpParameters);

            if (patientJournalResult.StatusCode == 400)
            {
                return(await ResponseService.GetResponse <BadRequestObjectResult, GetPatientJournalResponse>(patientJournalResult, ModelState));
            }
            else if (patientJournalResult.StatusCode == 404)
            {
                return(await ResponseService.GetResponse <NotFoundObjectResult, GetPatientJournalResponse>(patientJournalResult, ModelState));
            }

            return(new OkObjectResult(patientJournalResult));
        }
        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);
        }