protected void btnSave_Click(object sender, EventArgs e) { List<CMSTextWidgetPicker> lst = PickerValues; List<Guid> lstUpd1 = GeneralUtilities.GetCheckedItemGuidsByValue(gvContent, true, "chkSelect1"); List<Guid> lstUpd2 = GeneralUtilities.GetCheckedItemGuidsByValue(gvContent, true, "chkSelect2"); List<Guid> lstUpd3 = GeneralUtilities.GetCheckedItemGuidsByValue(gvContent, true, "chkSelect3"); List<Guid> lstUpd4 = GeneralUtilities.GetCheckedItemGuidsByValue(gvContent, true, "chkSelect4"); List<Guid> lstUpd5 = GeneralUtilities.GetCheckedItemGuidsByValue(gvContent, true, "chkSelect5"); lst.ForEach(x => { x.ProcessBody = lstUpd1.Contains(x.TextWidgetPickerID); x.ProcessPlainText = lstUpd2.Contains(x.TextWidgetPickerID); x.ProcessHTMLText = lstUpd3.Contains(x.TextWidgetPickerID); x.ProcessComment = lstUpd4.Contains(x.TextWidgetPickerID); x.ProcessSnippet = lstUpd5.Contains(x.TextWidgetPickerID); }); foreach (CMSTextWidgetPicker w in lst) { TextWidget ww = new TextWidget(); ww.SiteID = SiteID; ww.TextWidgetID = w.TextWidgetPickerID; ww.TextWidgetAssembly = w.AssemblyString; ww.ProcessBody = w.ProcessBody; ww.ProcessPlainText = w.ProcessPlainText; ww.ProcessHTMLText = w.ProcessHTMLText; ww.ProcessComment = w.ProcessComment; ww.ProcessSnippet = w.ProcessSnippet; if (ww.ProcessBody || ww.ProcessPlainText || ww.ProcessHTMLText || ww.ProcessComment || ww.ProcessSnippet) { ww.Save(); } else { ww.Delete(); } } if (SiteData.CurretSiteExists) { SiteData.CurrentSite.LoadTextWidgets(); } Response.Redirect(SiteData.CurrentScriptName); }
public ActionResult TextWidgetIndex(List<CMSTextWidgetPicker> model) { foreach (CMSTextWidgetPicker w in model) { TextWidget ww = new TextWidget(); ww.SiteID = this.SiteID; ww.TextWidgetID = w.TextWidgetPickerID; ww.TextWidgetAssembly = w.AssemblyString; ww.ProcessBody = w.ProcessBody; ww.ProcessPlainText = w.ProcessPlainText; ww.ProcessHTMLText = w.ProcessHTMLText; ww.ProcessComment = w.ProcessComment; ww.ProcessSnippet = w.ProcessSnippet; if (ww.ProcessBody || ww.ProcessPlainText || ww.ProcessHTMLText || ww.ProcessComment || ww.ProcessSnippet) { ww.Save(); } else { ww.Delete(); } } if (SiteData.CurretSiteExists) { SiteData.CurrentSite.LoadTextWidgets(); } return RedirectToAction("TextWidgetIndex"); }