public async Task <IActionResult> Create([FromBody] CompositeControl model) { model.Id = DataUtil.GenerateUniqueId(); await _controlRepository.AddAsync(model); return(Ok()); }
public async Task <IActionResult> Update(string id, [FromBody] CompositeControl model) { if (model.Id == id) { await _controlRepository.UpdateAsync(id, model); return(Ok()); } return(BadRequest()); }
internal void RenderPropertyEditors(HtmlTextWriter writer, string[] propertyDisplayNames, string[] propertyDescriptions, WebControl[] propertyEditors, string[] errorMessages) { Debug.Assert(propertyDisplayNames.Length == propertyEditors.Length); Debug.Assert(propertyDisplayNames.Length == errorMessages.Length); Debug.Assert(propertyDescriptions == null || (propertyDescriptions.Length == propertyDisplayNames.Length)); if (propertyDisplayNames.Length == 0) { return; } writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "4"); writer.RenderBeginTag(HtmlTextWriterTag.Table); for (int i = 0; i < propertyDisplayNames.Length; i++) { WebControl editUIControl = propertyEditors[i]; if (Zone != null && !Zone.EditUIStyle.IsEmpty) { editUIControl.ApplyStyle(Zone.EditUIStyle); } string propertyDescription = (propertyDescriptions != null) ? propertyDescriptions[i] : null; if (!String.IsNullOrEmpty(propertyDescription)) { writer.AddAttribute(HtmlTextWriterAttribute.Title, propertyDescription); } writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.RenderBeginTag(HtmlTextWriterTag.Td); if (editUIControl is CheckBox) { editUIControl.RenderControl(writer); writer.Write(" "); RenderDisplayName(writer, propertyDisplayNames[i], editUIControl.ClientID); } else { string associatedClientID; CompositeControl compositeControl = editUIControl as CompositeControl; if (compositeControl != null) { // The <label for> tag should point to the first child control of the // composite control. (VSWhidbey 372756) associatedClientID = compositeControl.Controls[0].ClientID; } else { // The <label for> tag should point to the editUIControl itself. associatedClientID = editUIControl.ClientID; } RenderDisplayName(writer, propertyDisplayNames[i] + ":", associatedClientID); writer.WriteBreak(); writer.WriteLine(); editUIControl.RenderControl(writer); } writer.WriteBreak(); writer.WriteLine(); string errorMessage = errorMessages[i]; if (!String.IsNullOrEmpty(errorMessage)) { if (Zone != null && !Zone.ErrorStyle.IsEmpty) { Zone.ErrorStyle.AddAttributesToRender(writer, this); } writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.WriteEncodedText(errorMessage); writer.RenderEndTag(); // Span writer.WriteBreak(); writer.WriteLine(); } writer.RenderEndTag(); // Td writer.RenderEndTag(); // Tr } writer.RenderEndTag(); // Table }
internal void RenderPropertyEditors(HtmlTextWriter writer, string[] propertyDisplayNames, string[] propertyDescriptions, WebControl[] propertyEditors, string[] errorMessages) { if (propertyDisplayNames.Length != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "4"); writer.RenderBeginTag(HtmlTextWriterTag.Table); for (int i = 0; i < propertyDisplayNames.Length; i++) { WebControl control = propertyEditors[i]; if ((this.Zone != null) && !this.Zone.EditUIStyle.IsEmpty) { control.ApplyStyle(this.Zone.EditUIStyle); } string str = (propertyDescriptions != null) ? propertyDescriptions[i] : null; if (!string.IsNullOrEmpty(str)) { writer.AddAttribute(HtmlTextWriterAttribute.Title, str); } writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.RenderBeginTag(HtmlTextWriterTag.Td); if (control is CheckBox) { control.RenderControl(writer); writer.Write(" "); this.RenderDisplayName(writer, propertyDisplayNames[i], control.ClientID); } else { string clientID; CompositeControl control2 = control as CompositeControl; if (control2 != null) { clientID = control2.Controls[0].ClientID; } else { clientID = control.ClientID; } this.RenderDisplayName(writer, propertyDisplayNames[i] + ":", clientID); writer.WriteBreak(); writer.WriteLine(); control.RenderControl(writer); } writer.WriteBreak(); writer.WriteLine(); string str3 = errorMessages[i]; if (!string.IsNullOrEmpty(str3)) { if ((this.Zone != null) && !this.Zone.ErrorStyle.IsEmpty) { this.Zone.ErrorStyle.AddAttributesToRender(writer, this); } writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.WriteEncodedText(str3); writer.RenderEndTag(); writer.WriteBreak(); writer.WriteLine(); } writer.RenderEndTag(); writer.RenderEndTag(); } writer.RenderEndTag(); } }