Пример #1
0
        public static PostLarge FromPost(Post post, string imageServer)
        {
            var cms = new List <CommentLarge>();

            foreach (var cm in post.Comment)
            {
                cms.Add(CommentLarge.FromComment(cm, imageServer));
            }
            var mds = new List <MediaSmall>();

            foreach (var md in post.MediaLink)
            {
                mds.Add(MediaSmall.FromMediaLink(md, imageServer));
            }
            return(new PostLarge
            {
                PostId = post.PostId,
                UpTime = post.UpTime,
                EditTime = post.EditTime,
                Title = post.Title,
                Content = post.Content,
                Price = post.Price,
                Status = post.Status,
                Address = post.Address,
                Tags = post.Tags,
                User = UserMedium.FromUser(post.User, imageServer),
                Comments = cms,
                Medias = mds
            });
        }
Пример #2
0
 public static CommentLarge FromComment(Comment comment, string imageServer)
 {
     return(new CommentLarge
     {
         CommentId = comment.CommentId,
         UpTime = comment.UpTime,
         Content = comment.Content,
         User = UserMedium.FromUser(comment.User, imageServer)
     });
 }