コード例 #1
0
        public BaseModelPagination <Produit> findLike(int categorie, string query = "", int page = 1, int maxResult = 10)
        {
            BaseModelPagination <Produit> pagination = new BaseModelPagination <Produit>(page, maxResult);

            dao.findLike(categorie, query, pagination, false);
            return(pagination);
        }
コード例 #2
0
 public BaseModelPagination <Categorie> GetAll(int page = 1, int maxResult = 10)
 {
     using (var context = new MyPlaceContext())
     {
         BaseModelPagination <Categorie> pagination = new BaseModelPagination <Categorie>(page, maxResult);
         pagination.totalResult = context.categorie.Count();
         pagination.liste       = context.categorie.OrderBy(i => i.Id).Skip(pagination.offset()).Take(maxResult).ToList();
         return(pagination);
     }
 }
コード例 #3
0
 public BaseModelPagination <ApplicationUser> GetAll(int page = 1, int maxResult = 10)
 {
     using (var context = new ApplicationDbContext())
     {
         BaseModelPagination <ApplicationUser> pagination = new BaseModelPagination <ApplicationUser>(page, maxResult);
         pagination.totalResult = context.Users.Count();
         pagination.liste       = context.Users.Include(i => i.Roles).OrderBy(i => i.Id).Skip(pagination.offset()).Take(maxResult).ToList();
         return(pagination);
     }
 }
コード例 #4
0
 public BaseModelPagination <Produit> FindAllDisponible(int categorie, string query, int page = 1, int maxResult = 10)
 {
     using (var context = new MyPlaceContext())
     {
         BaseModelPagination <Produit> pagination = new BaseModelPagination <Produit>(page, maxResult);
         IQueryable <Produit>          queryable  = context.produit.Include(p => p.Categorie).Where(p => p.QuantiteStock > 0);
         if (!string.IsNullOrWhiteSpace(query))
         {
             queryable = queryable.Where(p => p.Nom.ToLower().Contains(query.ToLower()));
         }
         if (categorie > 0)
         {
             queryable = queryable.Where(p => p.CategorieId == categorie);
         }
         pagination.liste = queryable.OrderBy(i => i.Nom)
                            .Skip(pagination.offset())
                            .Take(maxResult)
                            .ToList();
         pagination.totalResult = queryable.Count();
         return(pagination);
     }
 }