in src/React.Template/reactnet-webpack/Controllers/HomeController.cs [48:70]
public ActionResult Comments(int page)
{
var comments = _comments.Skip((page - 1) * COMMENTS_PER_PAGE).Take(COMMENTS_PER_PAGE);
var hasMore = page * COMMENTS_PER_PAGE < _comments.Count;
if (ControllerContext.HttpContext.Request.ContentType == "application/json")
{
return new JsonResult(new
{
comments = comments,
hasMore = hasMore
});
}
else
{
return View("~/Views/Home/Index.cshtml", new IndexViewModel
{
Comments = _comments.Take(COMMENTS_PER_PAGE * page).ToList().AsReadOnly(),
CommentsPerPage = COMMENTS_PER_PAGE,
Page = page
});
}
}