public async Task <IActionResult> CommentList(int topCount) { var commentList = await _commentManager.LoadEntities(topCount, out int totalCount, x => true, x => x.CommentId, false).ToListAsync(); if (commentList != null) { return(Ok(new { code = 0, count = commentList.Count, msg = "成功", data = commentList })); } return(Ok(new { code = 1, count = 0, msg = "失败", data = string.Empty })); }
public IViewComponentResult Invoke(int articleId) { CommentListViewModel commentListViewModel = new CommentListViewModel(); var commentList = _commentManager.LoadEntities(x => x.ArticleId == articleId).ToList(); commentListViewModel.ArticleId = articleId; commentListViewModel.List = commentList; return(View("CommentList", commentListViewModel)); }