public ActionResult GetLoadMoreData(LoadMore loadMore)
        {
            try
            {
                // Get current item ID.
                var currentItem = loadMore.itemID;

                // Get total comment count.
                var totalcount = int.Parse(loadMore.totalcount);

                // Get item per page for display.
                var itemsperpage = int.Parse(loadMore.itemsperpage);

                // Retrieve the comments from mongodb database.
                var comments = _objRepository.Retrieve(currentItem, true, null, null, "", "00000000-0000-0000-0000-000000000000").ToList();


                // Return the list of item for display.
                var result = RenderRazorViewToString("~/Components/CommentsMVC/Renderings/Views/LoadMoreComments.cshtml", comments.Skip(totalcount).Take(itemsperpage).ToList());
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { success = false, ex = e.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #2
0
        public ActionResult GetLoadMoreData(LoadMore loadMore)
        {
            try
            {
                // Get current item ID.
                var currentItem = loadMore.itemID;

                // Get total comment count.
                var totalcount = int.Parse(loadMore.totalcount);

                // Get item per page for display.
                var itemsperpage = int.Parse(loadMore.itemsperpage);

                // Retrieve the comments from mongodb database.
                var comments = _objRepository.Retrieve(currentItem, true, null, null, "");

                // Return the list of item for display.
                return(Json(comments.Skip(totalcount).Take(itemsperpage)));
            }
            catch (Exception e)
            {
                return(Json(new { success = false, ex = e.Message }, JsonRequestBehavior.AllowGet));
            }
        }