/// <summary> /// 获取热度评论的新闻列表 /// </summary> /// <returns>响应实体模型</returns> public ResponseModel GetNewCommentNewsList() { var list = newsCommentRepsitory.GetTopNewsComment(3);//top3 List <NewsModel> newsList = new List <NewsModel>(); foreach (var item in list) { var items = newsRepository.GetbyId(item.NewsId); newsList.Add(new NewsModel { Id = items.Id, Title = items.Title, Image = items.Image, PublishDate = items.PublishDate.ToLongDateString(), }); } return(new ResponseModel { code = 200, message = "最新评论新闻", data = newsList }); }
/// <summary> /// 获取热度新闻评论列表 /// </summary> /// <param name="topCount">要获取的Top数量</param> /// <returns>热度新闻评论列表</returns> public List <NewsComment> GetTopNewsComment(int topCount) { return(newsCommentRepsitory.GetTopNewsComment(topCount)); }