public AddEmbeddedCollection ( string name, IEnumerable |
||
name | string | |
objects | IEnumerable |
|
return |
public static HALResponse AddEmbeddedCollections(this HALResponse response, IEnumerable <KeyValuePair <string, IEnumerable <HALResponse> > > embeddedCollections) { foreach (var embeddedCollection in embeddedCollections) { response.AddEmbeddedCollection(embeddedCollection.Key, embeddedCollection.Value); } return(response); }
public static HALResponse AddEmbeddedCollection <T>(this HALResponse hyperMedia, string collectionName, IEnumerable <T> model, IEnumerable <Link> links = null) { if (links == null) { links = Enumerable.Empty <Link>(); } var embedded = model .Select(m => new HALResponse(m, hyperMedia.Config).AddLinks(links)) .ToArray(); hyperMedia.AddEmbeddedCollection(collectionName, embedded); return(hyperMedia); }