Example #1
0
 public ActionResult Index()
 {
     var model = new JobCateSearchViewModel();
     return View(model);
 }
Example #2
0
        public ActionResult getall(JobCateSearchViewModel model, int page = 1, int rows = 500)
        {
            var query = JobCateService.GetALL();

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

            var count = query.Count();

            var data = query.Select(x => new JobCateListViewModel()
            {
                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);
        }