Exemple #1
0
        private void CreateLinksForCohortGroups(
            LinkedResourceBaseDto wrapper,
            string orderBy,
            int pageNumber, int pageSize,
            bool hasNext, bool hasPrevious)
        {
            wrapper.Links.Add(
                new LinkDto(
                    _linkGeneratorService.CreateIdResourceUriForWrapper(ResourceUriType.Current, "GetCohortGroupsByDetail", orderBy, pageNumber, pageSize),
                    "self", "GET"));

            if (hasNext)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateIdResourceUriForWrapper(ResourceUriType.NextPage, "GetCohortGroupsByDetail", orderBy, pageNumber, pageSize),
                        "nextPage", "GET"));
            }

            if (hasPrevious)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateIdResourceUriForWrapper(ResourceUriType.PreviousPage, "GetCohortGroupsByDetail", orderBy, pageNumber, pageSize),
                        "previousPage", "GET"));
            }
        }
Exemple #2
0
        /// <summary>
        /// Prepare HATEOAS links for a identifier based collection resource
        /// </summary>
        /// <param name="wrapper">The linked dto wrapper that will host each link</param>
        /// <param name="metaResourceParameters">Standard parameters for representing resource</param>
        /// <param name="hasNext">Are there additional pages</param>
        /// <param name="hasPrevious">Are there previous pages</param>
        /// <returns></returns>
        private LinkedResourceBaseDto CreateLinksForReports(
            LinkedResourceBaseDto wrapper,
            IdResourceParameters metaResourceParameters,
            bool hasNext, bool hasPrevious)
        {
            wrapper.Links.Add(
                new LinkDto(
                    _linkGeneratorService.CreateIdResourceUriForWrapper(ResourceUriType.Current, "GetMetaReportsByIdentifier", metaResourceParameters.OrderBy, metaResourceParameters.PageNumber, metaResourceParameters.PageSize),
                    "self", "GET"));

            if (hasNext)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateIdResourceUriForWrapper(ResourceUriType.NextPage, "GetMetaReportsByIdentifier", metaResourceParameters.OrderBy, metaResourceParameters.PageNumber, metaResourceParameters.PageSize),
                        "nextPage", "GET"));
            }

            if (hasPrevious)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateIdResourceUriForWrapper(ResourceUriType.PreviousPage, "GetMetaReportsByIdentifier", metaResourceParameters.OrderBy, metaResourceParameters.PageNumber, metaResourceParameters.PageSize),
                        "previousPage", "GET"));
            }

            return(wrapper);
        }