Beispiel #1
0
        public ActionResult LoadMoreNewsfeed(int loadedPostCount)
        {
            var morePost = new MorePostViewModel();

            var posts = GetNewsfeed().ToList();
            var notLoadedCount = posts.Count - loadedPostCount;

            if (notLoadedCount <= DefautValue.PostLoad)
            {
                posts = posts.Skip(loadedPostCount).Take(notLoadedCount).ToList();
                morePost.NoMore = true;
            }
            else
            {
                posts = posts.Skip(loadedPostCount).Take(DefautValue.PostLoad).ToList();
                morePost.NoMore = false;
            }
            if (morePost.NoMore)
            {
                morePost.Posts = "";
                return Json(morePost);
            }

            morePost.Posts = RenderPartialViewToString("PostListPartial", posts);

            return Json(morePost);
        }
Beispiel #2
0
        public ActionResult LoadMorePost(string userId, int loadedPostCount)
        {
            var morePost = new MorePostViewModel();
            var fromUser = UserManager.FindById(userId);

            var posts = GetPosts(fromUser);
            var notLoadedCount = posts.Count - loadedPostCount;

            if (notLoadedCount <= DefautValue.PostLoad)
            {
                posts = posts.Skip(loadedPostCount).Take(notLoadedCount).ToList();
                morePost.NoMore = true;
            }
            else
            {
                posts = posts.Skip(loadedPostCount).Take(DefautValue.PostLoad).ToList();
                morePost.NoMore = false;
            }

            morePost.Posts = RenderPartialViewToString("PostList", posts);

            return Json(morePost);
        }