public ConvertResponse Convert(RenderContext context, JObject result) { var page = context.GetItem <Page>(); if (page == null || string.IsNullOrEmpty(page.Body) || page.Dom == null) { return(null); } string converttype = Lib.Helper.JsonHelper.GetString(result, "ConvertToType"); string convertname = Lib.Helper.JsonHelper.GetString(result, "Name"); var name = ConvertManager.GetUniqueName(context, converttype, convertname); View view = new View(); view.Name = name; view.Body = Lib.Helper.JsonHelper.GetString(result, "HtmlBody"); context.WebSite.SiteDb().Views.AddOrUpdate(view); return(new ConvertResponse { ComponentNameOrId = view.Name, Tag = "<view id='" + view.Name.ToString() + "'></view>", }); }
public ConvertResponse Convert(RenderContext context, JObject result) { var sitedb = context.WebSite.SiteDb(); string resultname = Lib.Helper.JsonHelper.GetString(result, "Name"); if (string.IsNullOrEmpty(resultname)) { resultname = "contentlist"; } string type = Lib.Helper.JsonHelper.GetString(result, "ConvertToType"); var name = ConvertManager.GetUniqueName(context, type, resultname); var data = Lib.Helper.JsonHelper.GetObject(result, "data"); var res = DataManager.AddData(sitedb, name, data); View view = new View(); view.Name = name; string viewbody = Lib.Helper.JsonHelper.GetString(result, "HtmlBody"); view.Body = UpdateViewTemplate(viewbody, res); sitedb.Views.AddOrUpdate(view); DataManager.AddGetContentListDataMethod(sitedb, view.Id, res.contentFolder.Id, "List"); return(new ConvertResponse() { IsSuccess = true, ComponentNameOrId = view.Name, Tag = "<view id='" + view.Name.ToString() + "'></view>" }); }
public ConvertResponse Convert(RenderContext context, JObject ConvertResult) { var page = context.GetItem <Page>(); if (page == null || string.IsNullOrEmpty(page.Body) || page.Dom == null) { return(null); } string convertname = Lib.Helper.JsonHelper.GetString(ConvertResult, "name"); string converttype = Lib.Helper.JsonHelper.GetString(ConvertResult, "ConvertToType"); var name = ConvertManager.GetUniqueName(context, converttype, convertname); Sites.Contents.Models.HtmlBlock block = new Contents.Models.HtmlBlock(); block.Name = name; string convertvalue = Lib.Helper.JsonHelper.GetString(ConvertResult, "HtmlBody"); var culture = string.IsNullOrEmpty(context.Culture) ? string.Empty : context.Culture; block.SetValue(culture, convertvalue); context.WebSite.SiteDb().HtmlBlocks.AddOrUpdate(block); return(new ConvertResponse() { IsSuccess = true, ComponentNameOrId = block.Name, Tag = "<htmlblock id='" + block.Name.ToString() + "'></htmlblock>" }); }