/// <summary>
 /// 分页查询评论表
 /// </summary>
 /// <param name="comFilter">对象</param>
 /// <param name="limit">一页的数量</param>
 /// <param name="page">当前第几页</param>
 /// <returns>Pagination</returns>
 public static dynamic Find(CommentMain_View comFilter, int limit, int page)
 {
     try
     {
         using (CMSDatabase_Model cms = new CMSDatabase_Model())
         {
             Pagination pagination = new Pagination();
             var        list       = from data in cms.CommentMain_View
                                     select data;
             if (comFilter.aid > 0)
             {
                 list = list.Where(data => data.aid == comFilter.aid).Select(data => data);
             }
             if (comFilter.uid > 0)
             {
                 list = list.Where(data => data.uid == comFilter.uid).Select(data => data);
             }
             pagination.total = list.Count();
             list             = list.OrderByDescending(data => data.cmid);
             list             = list.Skip(limit * (page - 1)).Take(limit);
             pagination.rows  = list.ToList();
             return(pagination);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 /// <summary>
 /// 分页查询评论表
 /// </summary>
 /// <param name="comFilter">对象</param>
 /// <param name="limit">一页的数量</param>
 /// <param name="page">当前第几页</param>
 /// <returns>Pagination</returns>
 public static dynamic Find(CommentMain_View comFilter, int limit, int page)
 {
     try
     {
         Pagination pagination = CMS_Comment_DAL.Find(comFilter, limit, page);
         return(pagination);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 /// <summary>
 /// 查询文章评论(分页)
 /// </summary>
 /// <param name="comFilter">对象</param>
 /// <returns>pagination</returns>
 public static dynamic Find(CommentMain_View comFilter)
 {
     try
     {
         var list = CMS_Comment_DAL.Find(comFilter);
         return(list);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
        //文章内容
        public ActionResult LaceMian(int id = 0)
        {
            try
            {
                if (id == 0)
                {
                    Response.Redirect("/Front/Home/Index");
                }
                else
                {
                    //查找文章
                    ArticleMain_View artFilter = new ArticleMain_View();
                    artFilter.aid = id;
                    var listArticle = CMS_Article_BLL.Find(artFilter);
                    ViewBag.articleList = listArticle;
                    //查账该文章的评论数
                    CMS_Comment comFilter = new CMS_Comment();
                    comFilter.aid = id;
                    var countCommentSum = CMS_Comment_BLL.FindCommentSum(comFilter);
                    if (countCommentSum == 0)
                    {
                        ViewBag.commentSumCount = 0;
                    }
                    else
                    {
                        ViewBag.commentSumCount = countCommentSum;
                    }
                    //查找该文章的评论
                    CommentMain_View comView = new CommentMain_View();
                    comView.aid = id;
                    var listComment = CMS_Comment_BLL.Find(comView);
                    ViewBag.commentList = listComment;

                    if (Session["userID"] != null)
                    {
                        ViewBag.userID = Session["userID"].ToString();
                    }
                    else
                    {
                        ViewBag.userID = "0";
                    }
                }
            }
            catch (Exception error)
            {
                throw error;
            }

            return(View());
        }
 public ActionResult Find(int rows, int page, int uid = 0, int aid = 0)
 {
     try
     {
         CommentMain_View comFilter = new CommentMain_View();
         if (uid > 0)
         {
             comFilter.uid = uid;
         }
         if (aid > 0)
         {
             comFilter.aid = aid;
         }
         Pagination pagination = CMS_Comment_BLL.Find(comFilter, rows, page);
         return(Json(pagination, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 查询文章评论
 /// </summary>
 /// <param name="comFilter">对象</param>
 /// <returns>pagination</returns>
 public static dynamic Find(CommentMain_View comFilter)
 {
     using (CMSDatabase_Model cms = new CMSDatabase_Model())
     {
         try
         {
             var list = from data in cms.CommentMain_View
                        select data;
             if (comFilter.aid == 0)
             {
                 throw new System.Exception("需要知道是哪一篇文章的评论");
             }
             else
             {
                 list = list.Where(data => data.aid == comFilter.aid).Select(data => data);
             }
             return(list.ToList());
         }
         catch (Exception error)
         {
             throw error;
         }
     }
 }