예제 #1
0
        public List <Produit> GetAllProduit()
        {
            ProduitQuery   pq    = new ProduitQuery(ctx);
            CategorieQuery cq    = new CategorieQuery(ctx);
            List <Produit> prods = pq.GetAll().ToList();

            prods.ForEach((p) =>
            {
                p.Categorie = cq.GetCategorie(p.CategorieId).FirstOrDefault();
            });
            return(prods);
        }
 /// <summary>
 /// Récupérer une liste de catégories en base
 /// </summary>
 /// <returns>Liste de Categorie</returns>
 public List <Categorie> GetAllCategorie()
 {
     try
     {
         CategorieQuery pq = new CategorieQuery(contexte);
         return(pq.GetAll().ToList());
     }
     catch (Exception e)
     {
         Console.WriteLine(e.InnerException);
     }
     return(null);
 }
예제 #3
0
        public Produit GetProduit(int id)
        {
            ProduitQuery   pq = new ProduitQuery(ctx);
            CategorieQuery cq = new CategorieQuery(ctx);
            Produit        p;
            Categorie      c;

            try
            {
                p           = pq.GetByID(id).First();
                c           = cq.GetCategorie(p.CategorieId).First();
                p.Categorie = c;
            }catch (Exception e)
            {
                throw e;
            }
            return(p);
        }
예제 #4
0
        public List <Produit> GetProduitByLib(String lib)
        {
            ProduitQuery   pq = new ProduitQuery(ctx);
            CategorieQuery cq = new CategorieQuery(ctx);
            List <Produit> prods;

            try
            {
                prods = pq.GetByLibelle(lib).ToList();
                prods.ForEach((p) =>
                {
                    p.Categorie = cq.GetCategorie(p.CategorieId).FirstOrDefault();
                });
            }catch (Exception e)
            {
                throw e;
            }

            return(prods);
        }
예제 #5
0
        public List <Produit> GetPreferredProduits()
        {
            ProduitQuery   pc = new ProduitQuery(ctx);
            CategorieQuery cq = new CategorieQuery(ctx);
            List <Produit> prods;

            try
            {
                prods = pc.GetPref().ToList();
                prods.ForEach((p) =>
                {
                    p.Categorie = cq.GetCategorie(p.CategorieId).FirstOrDefault();
                });
            }
            catch (Exception e)
            {
                throw e;
            }
            return(prods);
        }
예제 #6
0
        /// <summary>
        /// Récupérer une liste de catégories en base
        /// </summary>
        /// <returns>Liste de Categorie</returns>
        public List <Categorie> GetAllCategorie()
        {
            CategorieQuery pq = new CategorieQuery(contexte);

            return(pq.GetAll().ToList());
        }
예제 #7
0
        public Categorie GetCategorie(int id)
        {
            CategorieQuery pq = new CategorieQuery(contexte);

            return(pq.GetById(id).FirstOrDefault());
        }