private void InitDdls() { BllTemplateObjects = _service.GetAllTemplateObjects(_templateId).OrderBy(x => x.Name); BllRestTemplateObjects = _service.GetRestTemplateObjects(_templateId); if (_pageId.HasValue) { BllPageObjects = _service.GetAllPageObjects(_pageId.Value).OrderBy(x => x.Name); } PageObjects = HighlightedTAreaToolbarHelper.GenerateObjectListItems(BllPageObjects); TemplateObjects = HighlightedTAreaToolbarHelper.GenerateObjectListItems(BllTemplateObjects); RestTemplateObjects = HighlightedTAreaToolbarHelper.GenerateRestObjectListItems(BllRestTemplateObjects); if (IsContainer || IsForm) { var content = _service.ReadContentProperties(_contentId.Value); var fields = ServiceField.CreateAll() .Select(f => new ListItem { Text = f.ColumnName, Value = f.ColumnName }) .Concat(content.Fields.Select(x => new ListItem { Text = x.Name, Value = x.Name })) .ToList(); fields.Insert(0, new ListItem { Text = TemplateStrings.SelectField, Value = string.Empty }); Fields = fields; } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] ServiceField serviceField) { if (id != serviceField.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(serviceField); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceFieldExists(serviceField.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(serviceField)); }
private IEnumerable <ArticleSearchableField> GetArticleSystemFieldList() { return(ServiceField.CreateAll() // служебные поля .Select(f => new ArticleSearchableField { ID = f.ID.ToString(), Name = f.Name, ColumnName = f.ColumnName, ArticleFieldSearchType = f.ArticleFieldSearchType })); }
public async Task <IActionResult> Create([Bind("Id,Name")] ServiceField serviceField) { if (ModelState.IsValid) { _context.Add(serviceField); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(serviceField)); }
public JsonResult GetFieldsByContentId([FromBody] int contentId) { var content = _pageTemplateService.GetContentById(contentId); var statuses = _pageTemplateService.GetStatusIdsByContentId(contentId, out var hasWorkflow); return(Json(new { success = true, fields = string.Join(",", ServiceField.CreateAll() .Select(f => f.ColumnName).Concat(content.Fields.Select(x => x.Name))), statuses, hasWorkflow })); }
public JsonResult GetFieldsByContentId(int contentId) { var content = _pageTemplateService.GetContentById(contentId); var statuses = _pageTemplateService.GetStatusIdsByContentId(contentId, out var hasWorkflow); return(new JsonResult { Data = new { success = true, fields = string.Join(",", ServiceField.CreateAll().Select(f => f.ColumnName).Concat(content.Fields.Select(x => x.Name))), statuses, hasWorkflow }, JsonRequestBehavior = JsonRequestBehavior.DenyGet }); }