コード例 #1
0
 public ActionResult List(int page, int rows, string sidx, string sord, int? ParentId)
 {
     var categories = new CategoryService().List(ParentId);
     bool searchOn = bool.Parse(Request.Form["_search"]);
     string searchExp = "";
     
     var model = from entity in categories.OrderBy(sidx + " " + sord)
                 select new
                 {
                     Id = entity.ID,
                     Name = entity.CategoryName,
                     ParentCateId = entity.ParentCategoryId,
                     IsFeatured = entity.IsFeatured,
                     ShowOnHP = entity.ShowOnHP,
                     Articles = entity.CountArticles(true),
                     Url = Url.Action(Actions.Category.ToString(), SiteModules.Article.ToString(), new {id = entity.ID, Area=""})
                 };
     return Json(model.ToJqGridData(page, rows, null, "", new[] { "Name", "ParentCateId", "IsFeatured", "ShowOnHP" }), JsonRequestBehavior.AllowGet);
 }
コード例 #2
0
        public ActionResult FullList(int page, int rows, string sidx, string sord)
        {
            var categories = new CategoryService().List();
            bool searchOn = bool.Parse(Request.Form["_search"]);
            string searchExp = "";

            var model = from entity in categories.OrderBy(sidx + " " + sord)
                        select new
                        {
                            Id = entity.ID,
                            Name = entity.CategoryName,
                            Permission="category_" + entity.ID.ToString()
                        };
            return Json(model.ToJqGridData(page, rows, null, "", new[] { "Name", "ParentCateId", "IsFeatured", "ShowOnHP" }), JsonRequestBehavior.AllowGet);
        }