public JsonResult LoadData(int page, int pageSize)
        {
            IQueryable <ThucDon> lstThucDon = bll.LayTatCa() as IQueryable <ThucDon>;

            int            totalRow = lstThucDon.Count();
            List <ThucDon> lst      = new List <ThucDon>();

            foreach (var item in lstThucDon)
            {
                ThucDon td = new ThucDon()
                {
                    MaThucDon   = item.MaThucDon,
                    TenThucDon  = item.TenThucDon,
                    LoaiThucDon = item.LoaiThucDon,
                };
                lst.Add(td);
            }
            return(Json(new
            {
                data = lst.Skip((page - 1) * pageSize).Take(pageSize),
                total = totalRow,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult LoadForm()
        {
            IQueryable <ThucDon> lstThucDon = thucDonBll.LayTatCa() as IQueryable <ThucDon>;

            int            totalRow = lstThucDon.Count();
            List <ThucDon> lst      = new List <ThucDon>();

            foreach (var item in lstThucDon)
            {
                ThucDon td = new ThucDon()
                {
                    MaThucDon   = item.MaThucDon,
                    TenThucDon  = item.TenThucDon,
                    LoaiThucDon = item.LoaiThucDon,
                };
                lst.Add(td);
            }
            return(Json(new
            {
                data = lst,
                total = totalRow,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }