Ejemplo n.º 1
0
        public static IList <Article> FindByCategoryId(Int32 categoryId, IsMatchPager p)
        {
            //if (pId <= 0) return null;

            //// 实体缓存
            //if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.KId == pId);

            //// 单对象缓存
            ////return Meta.SingleCache[id];
            if (p == null)
            {
                p = new IsMatchPager();
            }
            p.Order   = "Desc";
            p.OrderBy = "Sequence";
            var exp = new WhereExpression();

            exp += _.IsDel == 0;
            if (categoryId > 0)
            {
                exp &= _.KId == categoryId;
            }
            p.TotalCount = FindCount(exp);
            return(FindAll(exp, p));
        }
Ejemplo n.º 2
0
        public virtual IActionResult GetList(int categoryId = 0, IsMatchPager p = null)
        {
            if (p == null)
            {
                p = new IsMatchPager();
            }
            var list   = Article.FindByCategoryId(categoryId, p);
            var result = PageResult.FromPager(p);

            result.Data = list;
            return(Json(result));
        }