public Task GetViewSetting([FromForm] int viewId) { //#1 获取视图对象 ViewSetting setting = ViewAgent.Instance().GetViewSetting(viewId); IViewBase view = ViewUtils.CreateInstance(setting.Code, string.Empty); return(this.GetResult(view.ToJsonString())); }
public Task GetSiteConfig([FromForm] int id) { ViewSiteConfig config = ViewAgent.Instance().GetSiteViewConfig(id); ViewSetting setting = ViewAgent.Instance().GetViewSetting(config.ViewID); IViewBase view = ViewUtils.CreateInstance(setting.Code, config.Setting); return(this.GetResult(view.ToSettingObject())); }
public Task SaveModelInfo() { ViewModel model = this.context.Request.Form.Fill <ViewModel>(); return(this.GetResult(ViewAgent.Instance().SaveModelInfo(model), "保存成功", new { model.ID })); }
public Task TemplateList([FromForm] PlatformSource platform) { return(this.GetResult(this.ShowResult(ViewAgent.Instance().GetTemplateList(platform), t => new { t.ID, t.Name, t.Platform, t.Preview }))); }
public Task SiteTemplateList([FromForm] int siteid) { return(this.GetResult(this.ShowResult(ViewAgent.Instance().GetSiteTemplateList(siteid), t => new { t.ID, t.Name, t.Platform, t.SiteID, t.Domain }))); }
public Task SaveTemplateInfo([FromForm] int id, [FromForm] string name, [FromForm] PlatformSource platform, [FromForm] string cover, [FromForm] string model) { ViewTemplate template = new ViewTemplate() { ID = id, Name = name, Platform = platform, Preview = cover }; return(this.GetResult(ViewAgent.Instance().SaveTemplateInfo(template, WebAgent.GetArray <int>(model)))); }
public Task SaveSiteTemplateInfo([FromForm] int id, [FromForm] string name, [FromForm] PlatformSource platform, [FromForm] string domain, [FromForm] int siteid, [FromForm] string model) { ViewSiteTemplate template = new ViewSiteTemplate() { ID = id, Name = name, Platform = platform, Domain = domain, SiteID = siteid }; return(this.GetResult(ViewAgent.Instance().SaveSiteTemplateInfo(template, WebAgent.GetArray <int>(model)))); }
public Task GetTemplateInfo([FromForm] int id) { ViewTemplate template = ViewAgent.Instance().GetTemplateInfo(id) ?? new ViewTemplate() { Configs = new List <ViewTemplateConfig>() }; return(this.GetResult(new { template.ID, template.Platform, template.Name, template.Preview, Models = template.Configs.Select(t => t.ModelID) })); }
public Task GetModelInfo([FromForm] int?id, [FromForm] int?viewId) { ViewModel model = ViewAgent.Instance().GetModelInfo(id == null ? 0 : id.Value) ?? new ViewModel() { ViewID = viewId ?? 0 }; List <ViewContent> contents = BDC.ViewContent.Where(t => t.ModelID == model.ID).ToList(); return(this.GetResult(new { model.ID, model.Name, model.Path, model.Preview, model.ViewID, model.Description, Resources = model.ResourceFiles, Content = contents })); }
public Task SaveModelFile([FromForm] int id, [FromForm] IFormFile file, [FromForm] long modified) { string name = file.FileName; string ext = name.Substring(name.LastIndexOf('.') + 1); bool success; switch (ext) { case "html": success = ViewAgent.Instance().SaveModelPage(id, Encoding.UTF8.GetString(file.ToArray())); break; case "css": success = ViewAgent.Instance().SaveModelStyle(id, Encoding.UTF8.GetString(file.ToArray())); break; default: success = ViewAgent.Instance().SaveModelResource(id, file); break; } return(this.GetResult(success)); }
public Task SaveSiteConfig([FromForm] int id, [FromForm] string setting) { return(this.GetResult(ViewAgent.Instance().SaveSiteViewConfig(id, setting))); }
public Task Initialize() { int count = ViewAgent.Instance().Initialize(); return(this.GetResult(true, $"找到{count}个视图配置")); }
public Task SiteTemplateDelete([FromForm] int id) { return(this.GetResult(ViewAgent.Instance().DeleteSiteTemplate(id))); }
public Task DeleteModelResource([FromForm] int modelId, [FromForm] string name) { return(this.GetResult(ViewAgent.Instance().DeleteModelResource(modelId, name))); }
public Task DeleteModel([FromForm] int id) { return(this.GetResult(ViewAgent.Instance().DeleteModel(id))); }
/// <summary> /// 全局的一次性执行 /// </summary> static SysFilterAttribute() { // 视图的数据初始化 ViewAgent.Instance().Initialize(); }