public void RemoveAttachment(DocumentHandle attachment)
 {
     if (Attachments.Contains(attachment))
     {
         Attachments.Remove(attachment);
     }
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 /// <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());
     }
 }