예제 #1
0
 public Comment(Post belongsTo, UserInfo author, string body)
 {
     Post = belongsTo;
     User = author;
     Body = body;
     CreationDate = DateTime.Now;
 }
예제 #2
0
        private static Post NewPost()
        {
            Post post =
                new Post()
                    .EnableComments()
                    .Publish();

            Posts.Add(post);
            return post;
        }
예제 #3
0
        private void FixupPost(Post previousValue)
        {
            if (previousValue != null && previousValue.Comments.Contains(this))
            {
                previousValue.Comments.Remove(this);
            }

            if (Post != null)
            {
                if (!Post.Comments.Contains(this))
                {
                    Post.Comments.Add(this);
                }
            }
        }