Beispiel #1
0
        public JsonResult LoadData(int menuType, int type, string keyword, int pageIndex, int pageSize)
        {
            string str   = NonUnicode.RemoveUnicode(keyword).ToLower();
            var    model = new MenuDao().ListAll();

            switch (type)
            {
            case 0: model = model.Where(x => NonUnicode.RemoveUnicode(x.Text.ToLower()).Contains(str) || x.Link.Contains(str)); break;

            case 1: model = model.Where(x => NonUnicode.RemoveUnicode(x.Text.ToLower()).Contains(str)); break;
            }
            model = model.Where(x => x.MenuTypeID == menuType);
            int totalRow = model.Count();

            model = model.OrderBy(x => x.DisplayOrder)
                    .Skip((pageIndex - 1) * pageSize)
                    .Take(pageSize);
            int totalRowCurent = model.Count();

            return(Json(new
            {
                data = model,
                total = totalRow,
                totalCurent = totalRowCurent,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }