Ejemplo n.º 1
0
 public HalResponseBuilder()
 {
     _linkObjects       = new JObject();
     _embeddedObjects   = new JArray();
     halLinkBuilder     = new HalLinksBuilder(_linkObjects);
     halEmbeddedBuilder = new HalEmbeddedBuilder(_embeddedObjects);
 }
Ejemplo n.º 2
0
        public HalEmbeddedBuilder AddObject(JObject jObj, Action <HalLinksBuilder> callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            var result   = AddObject(jObj);
            var linksObj = new JObject();
            var builder  = new HalLinksBuilder(linksObj);

            callback(builder);
            jObj.Add(Constants.DtoNames.HalResponse.Links, linksObj);
            return(this);
        }