コード例 #1
0
 // check if user <@param user name> is the publisher of the comment c.
 public static bool checkPublisherAuthorization(Comment c, string userName, string password)
 {
     User publisher = c.publisher;
     if (publisher != null && publisher.password == password && publisher.isLogged())
         return true;
     return false;
 }
コード例 #2
0
 // POCO constructor
 public Comment(Comment c)
 {
     this.commentId = c.commentId;
     this.content = c.content;
     this.publishDate = c.publishDate;
     this.publisher = new User(c.publisher);
     this.parentDiscussion = null;
 }
コード例 #3
0
 internal Comment createNewComment(string content, User user, ForumGeneratorContext db)
 {
     content = content.Replace("/","//");
     Comment newComment = new Comment(content, user, this);
     //lock (db)
     //{
         this.comments.Add(newComment);
         db.Comments.Add(newComment);
         db.SaveChanges();
     //}
     return newComment;
 }