public void RemoveAttachments(IList <ResourceBE> attachmentToRemove, DateTime timestamp, uint transactionId)
        {
            //TODO MaxM: This batch remove exists solely to mark all files as deleted when a parent page is deleted..
            List <ulong> pageIds = new List <ulong>();

            foreach (ResourceBE file in attachmentToRemove)
            {
                file.AssertHeadRevision();
                pageIds.Add(file.ParentPageId.Value);
            }
            Dictionary <ulong, PageBE> pagesById = PageBL.GetPagesByIdsPreserveOrder(pageIds).AsHash(e => e.ID);

            foreach (ResourceBE file in attachmentToRemove)
            {
                PageBE parentPage;
                if (pagesById.TryGetValue(file.ParentPageId.Value, out parentPage))
                {
                    _resourceBL.Delete(file, parentPage, transactionId);
                }
            }
        }
Beispiel #2
0
 public ResourceBE DeleteProperty(ResourceBE prop, ResourceBE.ParentType parentType, XUri parentUri)
 {
     DekiContext.Current.Instance.EventSink.PropertyDelete(DekiContext.Current.Now, prop, DekiContext.Current.User, parentType, parentUri);
     return(_resourceBL.Delete(prop));
 }