public ActionResult ListMore(int newsId = 0, int total = 0, int page = 1) { var pageInfo = new PageInfo(AppConfigs.CommentsPageSize, page); var vm = new ListNewsCommentViewModel { NewsId = newsId, Total = total }; var feedback = _commentRepository.GetNewsComments(newsId, pageInfo); if (feedback.Success) { vm.Comments = feedback.Data; vm.CurrentUserId = CurrentUser != null ? CurrentUser.UserInfo.Id : 0; vm.HasMore = vm.Total > pageInfo.PageSize * pageInfo.PageNo; } return View(vm); }
public ActionResult List(int newsId = 0, int total = 0) { var pageInfo = new PageInfo(AppConfigs.CommentsPageSize, 1); var vm = new ListNewsCommentViewModel { NewsId = newsId, Total = total, HighlightComments = new List<NewsComment>() }; var feedback = _commentRepository.GetNewsComments(newsId, pageInfo); var feedback2 = _commentRepository.GetHighlightNewsComments(newsId, AppConfigs.HighlightCommentNumber); if (feedback.Success && feedback2.Success) { vm.Comments = feedback.Data; vm.HighlightComments = feedback2.Data; vm.CurrentUserId = CurrentUser != null ? CurrentUser.UserInfo.Id : 0; vm.HasMore = vm.Total > pageInfo.PageSize * pageInfo.PageNo; } return View(vm); }
public ActionResult Comment(NewsComment pc) { var vm = new ListNewsCommentViewModel { Comments = new List<NewsComment>(), CurrentUserId = CurrentUser.UserInfo.Id }; if (ModelState.IsValid) { pc.PostedById = CurrentUser.UserInfo.Id; // Call Repository to perform insert var feedback = _commentRepository.InsertNewsComment(pc); if (feedback.Success) { vm.Comments.Add(feedback.Data); return View(vm); } } return View(vm); }