Exemplo n.º 1
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="auditLogResourceParameters">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 CreateLinksForAuditLogs(
            LinkedResourceBaseDto wrapper,
            AuditLogResourceParameters auditLogResourceParameters,
            bool hasNext, bool hasPrevious)
        {
            wrapper.Links.Add(
                new LinkDto(
                    _linkGeneratorService.CreateAuditLogsResourceUri(ResourceUriType.Current, auditLogResourceParameters),
                    "self", "GET"));

            if (hasNext)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateAuditLogsResourceUri(ResourceUriType.NextPage, auditLogResourceParameters),
                        "nextPage", "GET"));
            }

            if (hasPrevious)
            {
                wrapper.Links.Add(
                    new LinkDto(
                        _linkGeneratorService.CreateAuditLogsResourceUri(ResourceUriType.PreviousPage, auditLogResourceParameters),
                        "previousPage", "GET"));
            }

            return(wrapper);
        }