// 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; }
// 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; }
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; }