Exemplo n.º 1
0
        //[Route("getall")]
        public PhanTrang <SanPham_OBJ> GetAlls(int trang, int SoBanGhi, int MaLoaiSanPham)
        {
            int DoDaiDanhSach = 0;

            SanPham_BUS bus      = new SanPham_BUS();
            var         DanhSach = bus.TimKiemThongTinTheoMaLoaiSanPham(MaLoaiSanPham);

            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);
        }