Exemplo n.º 1
0
        // GET: Suppliers
        public async Task <IActionResult> Index(string currentSort, int?page)
        {
            int pageIndex = 1;
            int pageSize  = 5;

            //判断page是否有值,有的话就给值,没有就赋值1
            pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;
            IPagedList <Supplier> lstStudent = null;

            lstStudent = await _context.Set <Supplier>().Include("SupplierType").OrderByDescending(s => s.SupplierName).ToPagedListAsync(pageIndex, pageSize);

            return(View(lstStudent));
        }
Exemplo n.º 2
0
        public IViewComponentResult Invoke(string currentSort, int?page)
        {
            int pageIndex = 1;
            int pageSize  = 5;

            //判断page是否有值,有的话就给值,没有就赋值1
            pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;

            IPagedList <Supplier> lstStudent = null;

            lstStudent = _context.Set <Supplier>().Include("SupplierType").OrderByDescending(s => s.SupplierName).ToPagedList(pageIndex, pageSize);

            return(View(lstStudent));
        }
Exemplo n.º 3
0
 public Repository(SupplierContext context)
 {
     Context = context;
     DbSet   = context.Set <T>();
 }
Exemplo n.º 4
0
 public GenericRepository(SupplierContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _dbSet     = _dbContext.Set <T>();
 }