コード例 #1
0
        /// <summary>
        /// Format HAL collection
        /// </summary>
        /// <param name="collection">collection to format</param>
        /// <returns>HAL json</returns>
        public HALResponse FormatForHal(CollectionResource <InsolvencyOrderAddressModel> collection)
        {
            Requires.NotNull(collection, nameof(collection));

            var uri = requestReader.GetRequestUri();

            Link[] links =
            {
                addressResolver.GetLink(DomainResources.InsolvencyOrderAddress,   CommonLinks.Self),
                addressResolver.GetLink(DomainResources.InsolvencyOrderAddresses, CommonLinks.Parent)
            };

            var collectionResponse =
                new HALResponse(collection.Information, new HALModelConfig {
                ForceHAL = true
            })
                .AddLinks(pagingLinks.GetPagingLinks(uri, collection.Information.CurrentPage, collection.Information.NumberOfPages))
                .AddEmbeddedCollection(
                    collectionName: DomainResources.InsolvencyOrderAddresses_camelCase,
                    model: collection.Resources,
                    links: links);

            return(collectionResponse);
        }
コード例 #2
0
 /// <inheritdoc />
 public Link GetLinkToSelf()
 {
     return(new Link(CommonLinks.Self, requestReader.GetRequestUri().PathAndQuery));
 }