Exemple #1
0
        public async Task <IActionResult> GetFundingStructures(
            [FromRoute] string fundingStreamId,
            [FromRoute] string fundingPeriodId,
            [FromRoute] string specificationId)
        {
            string etag = Request.ReadETagHeaderValue();

            ApiResponse <FundingStructure> fundingStructureApiResponse = await _specificationsApiClient.GetFundingStructure(fundingStreamId,
                                                                                                                            fundingPeriodId,
                                                                                                                            specificationId,
                                                                                                                            etag);

            if (fundingStructureApiResponse.StatusCode == HttpStatusCode.NotModified)
            {
                return(new StatusCodeResult(304));
            }

            Response.CopyCacheControlHeaders(fundingStructureApiResponse.Headers);

            IActionResult fundingStructureErrorResult =
                fundingStructureApiResponse.IsSuccessOrReturnFailureResult("GetFundingStructures");

            if (fundingStructureErrorResult != null)
            {
                return(fundingStructureErrorResult);
            }

            return(Ok(fundingStructureApiResponse.Content.Items));
        }