public async Task <EmbeddedBlog> CreateBlog()
        {
            string       blogId = Guid.NewGuid().ToString();
            EmbeddedBlog blog   = new EmbeddedBlog
            {
                BlogId   = blogId,
                Id       = blogId,
                Type     = "Post",
                Content  = TextHelper.OneMBText,
                Comments = new List <Comment>()
            };
            //for(int i = 1; i < 11; i++)
            //{
            //    blog.Comments.Add(new Comment
            //    {
            //        CommentId = i.ToString(),
            //        Id = i.ToString(),
            //        Likes = i,
            //        Details = " this is comment "+ i
            //    });
            //}
            await _blogsRepository.AddAsync(blog);

            // Console.WriteLine();
            return(blog);
        }
Esempio n. 2
0
        public async Task <Blog> CreateBlog()
        {
            string blogId = Guid.NewGuid().ToString();

            Blog blog = new Blog
            {
                BlogId   = blogId,
                Id       = blogId,
                Type     = "Post",
                Content  = TextHelper.OneMBText,
                Comments = new List <string>()
            };
            Blog blogCreated = await _blogsRepository.AddAsync(blog);

            // Console.WriteLine(blogCreated);
            return(blogCreated);
        }
Esempio n. 3
0
        public async Task <Comment> CreateComment(Blog blog)
        {
            string  commentId = Guid.NewGuid().ToString();
            Comment comment   = new Comment
            {
                CommentId = commentId,
                Id        = commentId,
                Details   = TextHelper.OneMBText,
                BlogId    = blog.BlogId,
                Likes     = 40
            };

            blog.Comments.Add(commentId);
            await _commentsRepository.AddAsync(comment);

            // Console.WriteLine();
            UpdateBlog(blog);
            return(comment);
        }