/// <summary> /// /// </summary> /// <param name="gcTemplateId"></param> /// <returns></returns> public List <GcTabModel> GetFieldsByTemplateId(string gcTemplateId) { var model = new List <GcTabModel>(); var gcTemplate = TemplateService.GetSingleTemplate(gcTemplateId); foreach (var config in gcTemplate.Data.Config) { var tab = new GcTabModel { TabName = config.Label }; foreach (var element in config.Elements) { var tm = new GcFieldModel { Name = element.Label, Id = element.Name, Type = element.Type }; tab.Fields.Add(tm); } model.Add(tab); } return(model); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> protected TemplateEntity GetGcTemplateEntity(string id) { TemplateEntity template; var key = "template_" + id; if (CacheManager.IsSet(key)) { template = CacheManager.Get <TemplateEntity>(key); } else { template = TemplatesService.GetSingleTemplate(id); CacheManager.Set(key, template, 60); } return(template); }