/// <summary> /// Format HAL response /// </summary> /// <param name="item">Item to format</param> /// <returns>formatted item</returns> public HALResponse FormatForHal(InsolvencyOrderTradingDetailsModel item) { Requires.NotNull(item, nameof(item)); var hal = new HALResponse( item, new HALModelConfig { ForceHAL = true }) .AddLinks(new[] { addressResolver.GetLink(DomainResources.InsolvencyOrderTradingDetail, CommonLinks.Self), addressResolver.GetLink(DomainResources.InsolvencyOrderTradingDetails, CommonLinks.Parent) }); return(hal); }
/// <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); }