示例#1
0
 public ActionResult Index()
 {
     var model = new RuleCateSearchViewModel();
     return View(model);
 }
示例#2
0
        public ActionResult getall(RuleCateSearchViewModel model, int page = 1, int rows = 500)
        {
            var query = RuleCateService.GetALL();

            if (!string.IsNullOrEmpty(model.RuleCate_SearchName))
            {
                query = query.Where(x => x.CateName.Contains(model.RuleCate_SearchName));
            }

            var count = query.Count();

            var data = query.Select(x => new RuleCateListViewModel()
            {
                ID = x.ID,

                CateName = x.CateName,

                PID = x.PID,
                _parentId = x.PID,
                Code = x.Code,

                Level = x.Level,

                OrderIndex = x.OrderIndex,

            })
            .OrderBy(x => x.ID)
            .Skip((page - 1) * rows)
            .Take(rows).ToList();

            var obj = new
            {
                rows = data,
                total = count
            };
            return Json(obj);
        }