コード例 #1
0
 public void RemoveAttachment(DocumentHandle attachment)
 {
     if (Attachments.Contains(attachment))
     {
         Attachments.Remove(attachment);
     }
 }
コード例 #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);
     }
 }
コード例 #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());
     }
 }