Ejemplo n.º 1
0
        private static Post GetPost(ISocialContent content, PostStreamReader postStreamReader = null)
        {
            var postReader = postStreamReader ?? ServiceLocator.Current.GetInstance <PostStreamReader>();
            var post       = postReader.GetPostByExternalId(content.ContentGuid.ToString());

            return(post);
        }
Ejemplo n.º 2
0
        public static IEnumerable <Comment> GetComments(this ISocialContent content)
        {
            var postReader = ServiceLocator.Current.GetInstance <PostStreamReader>();
            var post       = GetPost(content, postReader);

            return(post != null?postReader.GetComments(post.Id) : Enumerable.Empty <Comment>());
        }
Ejemplo n.º 3
0
        public static void AddComment(this ISocialContent content, Comment comment)
        {
            var postWriter = ServiceLocator.Current.GetInstance <PostWriter>();
            var post       = GetPost(content);
            var postId     = post != null ? post.Id : content.CreatePost(postWriter);

            postWriter.CreateComment(postId, comment);
        }
Ejemplo n.º 4
0
        internal static int CreatePost(this ISocialContent content, PostWriter postWriter = null)
        {
            var writer = postWriter ?? ServiceLocator.Current.GetInstance <PostWriter>();

            return(writer.CreatePost(null, null, content.ContentGuid.ToString()));
        }