void FormStorage_Deleted(object sender, Umbraco.Forms.Core.FormEventArgs e) { // If this Form was stored in a Folder, remove it. var form = e.Form; var folder = PerplexFolder.Get(f => f.Forms.Any(fid => fid == form.Id.ToString())); if (folder != null) { folder.Forms.Remove(form.Id.ToString()); PerplexFolder.SaveAll(); } }
void FormStorage_Created(object sender, Umbraco.Forms.Core.FormEventArgs e) { var form = e.Form; // Was this form created in a folder? var sessionId = UmbracoContext.Current.Security.GetSessionId(); var folderId = HttpContext.Current.Cache[sessionId + "_folderId"]; if (folderId == null) { return; } var folder = PerplexFolder.Get(folderId.ToString()); if (folder == null) { return; } folder.Forms.Add(form.Id.ToString()); PerplexFolder.SaveAll(); }