Example #1
0
 private static void MapThread(ThreadModel threadModel, DbThread thread)
 {
     threadModel.Id           = thread.ThreadId;
     threadModel.Viewed       = thread.Viewed;
     threadModel.NewPostCount = thread.NewPostCount;
     threadModel.PostCount    = thread.PostCount;
 }
Example #2
0
        public static ThreadModel CreateThreadModel(this DbPost post, DbThread thread, IEnumerable <DbRating> ratings,
                                                    int userId, DbPost parent)
        {
            var threadModel =
                post.UserId == userId ? new PostActivityModel() :
                parent != null && parent.UserId == userId ? new ReplyActivityModel() :
                new ThreadModel();

            MapPost(threadModel, post);
            MapThread(threadModel, thread);
            MapRatings(threadModel, ratings);

            return(threadModel);
        }