Пример #1
0
        public static List <CommentsModels> ParseComments(List <Kumentaryo> kumentaryo)
        {
            List <CommentsModels> cmList = new List <CommentsModels>();

            foreach (Kumentaryo k in kumentaryo)
            {
                CommentsModels cm = new CommentsModels();
                cm.Comment               = k.Comment;
                cm.CommentDate           = k.DatePosted;
                cm.CommentId             = k.CommentId;
                cm.CommentorsId          = k.CommentorsId;
                cm.CommentorsDisplayName = k.TagIya.ScreenName;
                cm.MessageId             = k.MessageId;
                cmList.Add(cm);
            }

            return(cmList);
        }
Пример #2
0
        private PostsModels GetPostsModel(TagIya tagIya, Mensahe msg)
        {
            MensaheRepository mr   = new MensaheRepository();
            PostsModels       post = new PostsModels();

            post.DisplayName   = tagIya.ScreenName;
            post.Message       = msg.Message;
            post.Comments      = CommentsModels.ParseComments(msg.Kumentaryos.ToList());
            post.DatePosted    = msg.DatePosted;
            post.NumberOfVotes = mr.GetMessageVotes(msg.MessageId);
            post.PostUserId    = tagIya.UserId;
            post.MessageId     = msg.MessageId;
            if (string.IsNullOrEmpty(tagIya.Gravatar))
            {
                post.Gravatar = Utility.GetMD5Hash(PostHelper.GetRandomString(10) + "@no-email.com");
            }
            else
            {
                post.Gravatar = Utility.GetMD5Hash(tagIya.Gravatar);
            }

            return(post);
        }