Beispiel #1
0
        public void Update(Guid PageId, ApiCall call)
        {
            var page = call.WebSite.SiteDb().Pages.Get(PageId);

            if (page == null)
            {
                return;
            }

            call.Context.SetItem <Page>(page);

            // pageid,...updates...
            if (string.IsNullOrEmpty(call.Context.Request.Body))
            {
                return;
            }
            var model = Lib.Helper.JsonHelper.Deserialize <dynamic>(call.Context.Request.Body);

            List <IInlineModel> updatemodels = new List <IInlineModel>();

            foreach (var item in model.updates)
            {
                string editortype  = item.editorType;
                var    modeltype   = EditorContainer.GetModelType(editortype);
                var    updatemodel = ((JObject)item).ToObject(modeltype) as IInlineModel;
                if (updatemodel != null)
                {
                    updatemodels.Add(updatemodel);
                }
            }

            UpdateManager.Execute(call.Context, updatemodels);
        }