//[Route("getall")] public PhanTrang <SanPham_OBJ> GetAll(int trang, int SoBanGhi, string TuKhoa) { int DoDaiDanhSach = 0; SanPham_BUS bus = new SanPham_BUS(); var DanhSach = bus.TimKiemThongTinSanPham(TuKhoa); DoDaiDanhSach = DanhSach.Count(); var TrangSanPham = DanhSach.OrderByDescending(x => x.MaSanPham).Skip(trang * SoBanGhi).Take(SoBanGhi); var PhanTrang = new PhanTrang <SanPham_OBJ>() { DanhSach = TrangSanPham, Trang = trang, SoBanGhi = SoBanGhi, SoTrang = (int)Math.Ceiling((decimal)DoDaiDanhSach / SoBanGhi) }; return(PhanTrang); }