public async Task <IActionResult> GetAllPatientJournals([FromBody] GetAllPatientJournalslWithCapViewModel model, [FromHeader] string authorization)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            HttpParameters httpParameters =
                HttpParametersService
                .GetHttpParameters(
                    model,
                    ConfigHelper.AppSetting(Constants.ServerUrls, Constants.GetAllPatientJournals),
                    HttpMethod.Post,
                    string.Empty,
                    authorization);

            GetAllPatientJournalsResponse getPatientJournalsResult =
                await _gWService.PostTo <GetAllPatientJournalsResponse>(httpParameters);


            if (getPatientJournalsResult.StatusCode == 422)
            {
                return(await ResponseService
                       .GetResponse <UnprocessableEntityObjectResult, GetAllPatientJournalsResponse>(getPatientJournalsResult, ModelState));
            }

            return(new OkObjectResult(getPatientJournalsResult));
        }
        public async Task <IActionResult> GetAllPatientJournals(GetAllPatientJournalslWithCapViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            AllPatientJournals patientJournals = await _aerendeService.GetAllPatientJournalsWithCap(model.Cap);

            if (patientJournals.IsNull)
            {
                return(new JsonResult(await Errors
                                      .GetGenericErrorResponse(
                                          new GetAllPatientJournalsResponse()
                {
                    PatientJournals = patientJournals.PatentJournals,
                    StatusCode = 422,
                    Error = "Get patient journals error",
                    Description = "Unable to return Patient journals",
                    Code = "get_pateint_journals_error"
                })));
            }

            return(new JsonResult(Wrappyfier.WrapPatientJournalsResponse(patientJournals)));
        }
        public async Task <IActionResult> GetAllPatientJournals(GetAllPatientJournalslWithCapViewModel model, [FromHeader] string authorization)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            HttpParameters httpParameters =
                HttpParametersService.GetHttpParameters(
                    model,
                    ConfigHelper.AppSetting(AerendeConstants.ServerUrls, AerendeConstants.PatientJournals),
                    HttpMethod.Post,
                    string.Empty,
                    authorization
                    );

            GetAllPatientJournalsResponse getPatientJournalsResult = await _aerendeService.PostTo <GetAllPatientJournalsResponse>(httpParameters);

            return(new JsonResult(getPatientJournalsResult));
        }