public ActionResult Index() { var model = new ContractCateSearchViewModel(); return View(model); }
public ActionResult getall(ContractCateSearchViewModel model, int page = 1, int rows = 500) { var query = ContractCateService.GetALL(); if (!string.IsNullOrEmpty(model.ContractCate_SearchName)) { query = query.Where(x => x.CateName.Contains(model.ContractCate_SearchName)); } var count = query.Count(); var data = query.Select(x => new ContractCateListViewModel() { 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); }