Esempio 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));
        }
Esempio 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));
        }
Esempio n. 3
0
 public Repository(SupplierContext context)
 {
     Context = context;
     DbSet   = context.Set <T>();
 }
Esempio n. 4
0
 public GenericRepository(SupplierContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _dbSet     = _dbContext.Set <T>();
 }