public override void UpdateFileAttachment(FileAttachment attachment) { //Check attachment if (attachment != null) Attachment.FileHelper.CheckFile(attachment, attachment.Article.Category.AttachExtensions, attachment.Article.Category.AttachMaxSize); using (TransactionScope transaction = new TransactionScope(mConfiguration)) { FileAttachmentDataStore dataStore = new FileAttachmentDataStore(transaction); dataStore.Update(attachment); transaction.Commit(); } }
public override FileAttachment CreateFileAttachment(Article article, string name, string contentType, byte[] contentData) { FileAttachment attachment = new FileAttachment(article, name, contentType, contentData); //Check attachment if (attachment != null) Attachment.FileHelper.CheckFile(attachment, article.Category.AttachExtensions, article.Category.AttachMaxSize); using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ArticleDataStore dataStore = new ArticleDataStore(transaction); dataStore.Attach(article); FileAttachmentDataStore attachmentStore = new FileAttachmentDataStore(transaction); attachmentStore.Insert(attachment); transaction.Commit(); return attachment; } }
public override void DeleteFileAttachment(FileAttachment attachment) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { FileAttachmentDataStore dataStore = new FileAttachmentDataStore(transaction); dataStore.Delete(attachment.Id); transaction.Commit(); } }
public abstract void UpdateFileAttachment(FileAttachment attachment);
public abstract void DeleteFileAttachment(FileAttachment attachment);
public static void DeleteFileAttachment(FileAttachment attachment) { Provider.DeleteFileAttachment(attachment); }
public static void UpdateFileAttachment(FileAttachment attachment) { Provider.UpdateFileAttachment(attachment); }