예제 #1
0
        public static RestContentItem ToRest(this ContentEmbedded contentItem)
        {
            RestContentItem restContentItem = new RestContentItem();

            restContentItem.Schema = JObject.FromObject(contentItem.Schema.ToRest());

            foreach (var field in contentItem.Fields)
            {
                restContentItem.Fields.Add(field.Key, field.Value.ToRestValue());
            }

            return(restContentItem);
        }
예제 #2
0
        public static ContentEmbedded ToModel(this RestContentEmbedded restContentItem)
        {
            ContentSchema schema = restContentItem.Schema.ToModel();

            ContentEmbedded contentItem = schema.CreateContentEmbedded();

            foreach (var restField in restContentItem.Fields)
            {
                restField.Value.FromRestValue(restField.Key, contentItem, schema);
            }

            return(contentItem);
        }