Exemplo n.º 1
0
 public ActionResult Index()
 {
     var model = new CityCateSearchViewModel();
     return View(model);
 }
Exemplo n.º 2
0
        public ActionResult getall(CityCateSearchViewModel model, int page = 1, int rows = 500)
        {
            var query = CityCateService.GetALL();

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

            var count = query.Count();

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