public void RemoveAttachment(DocumentHandle attachment) { if (Attachments.Contains(attachment)) { Attachments.Remove(attachment); } }
public void removeAttachment(Attachment attachment, User currUser) { if (!currUser.Admin && !Users.Contains(currUser)) { throw new InvalidAccessException(); } else if (!Attachments.Contains(attachment)) { throw new DoNotContainElementException(); } else { Attachments.Remove(attachment); } }
/// <summary> /// Gets the attachments for the current post. /// </summary> /// <returns>The attachments</returns> public IList <Media> GetAttachments() { using (var db = new DataContext()) { return(db.Media.Where(m => Attachments.Contains(m.Id)).ToList()); } }