Пример #1
0
        /// <summary>
        /// 后台评论分布视图
        /// </summary>
        /// <returns></returns>
        public ActionResult BackCommentPartial(int?pageindex, int?SelectType)
        {
            int index = SelectType ?? 0;
            List <CommentTable> list = new List <CommentTable>();

            if (index == 0)
            {
                list = CommentBll.SelectAllComment().OrderByDescending(p => p.IsTop).ToList();
            }
            else if (index == 5)
            {
                //查询违规评论
                list = CommentBll.SelectAllComment().Where(p => p.Reportingnums > 0).OrderByDescending(p => p.IsTop).OrderByDescending(p => p.Reportingnums).ToList();
            }
            else
            {
                //查询第一大类的商品评论
                list = CommentBll.SelectByTidComment(index).OrderByDescending(p => p.IsTop).ToList();
                //增加userinfo对象,防止报错
                list.ForEach(p => p.UserInfo = UserInfoBll.SelectUser(p.UserID ?? 1));
            }
            if (list != null && list.Count() > 0)
            {
                Session["plcount"] = list.Count();
            }
            else
            {
                Session["plcount"] = 0;
            }
            ViewBag.SelectType     = index;
            ViewBag.pageindex      = pageindex ?? 1;
            Session["plpagecount"] = Math.Ceiling(list.Count() / 10.0);
            Session["allpl"]       = list.Skip(((pageindex ?? 1) - 1) * 10).Take(10).ToList();
            return(PartialView("BackCommentPartial"));
        }