Example #1
0
        private static void CreateInitialPost(User adminUser, IDocumentSession session)
        {
            bool hasPosts = session.Query<Post>().Any();

            if (!hasPosts)
            {
                var welcomePost = new Post
                {
                    Title = "Welcome to your new blog!!!",
                    Body = "Hi, LTA Blog would like to congratulate you for creating your new blog site!!!",
                    AllowComments = false,
                    AuthorId = adminUser.Id,
                    CreatedAt = DateTimeOffset.Now,
                    IsActive = true
                };
                welcomePost.Tags.Add("General");

                session.Store(welcomePost);
            }
        }
Example #2
0
        public static User GetPostAuthor(this IDocumentSession session, Post post)
        {
            var user = session.Load<User>(post.AuthorId);

            return user;
        }