public void DeleteEntry(Guid entryId) { try { using (var recordStorage = new RecordStorage()) { var record = recordStorage.GetRecordByUniqueId(entryId); if (record == null) { return; } var form = record.GetForm(); if (form == null) { return; } LogHelper.Info <UmbracoFormsRetentionApiController>($"Deleting record '{record.UniqueId}' for form '{form.Name}' with id '{form.Id}'."); recordStorage.DeleteRecord(record, form); } } catch (Exception exception) { LogHelper.Error <UmbracoFormsRetentionApiController>(exception.Message, exception); throw; } }
public void DeleteComments(int pageId, Guid formId) { using (var formStorage = new FormStorage()) { using (var recordStorage = new RecordStorage()) { var form = formStorage.GetForm(formId); var records = recordStorage.GetAllRecords(form) .Where(x => x.UmbracoPageId == pageId) .ToList(); foreach (var record in records) { recordStorage.DeleteRecord(record, form); } } } }