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); }
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); }
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); }
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); }
/// <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()); }
public Categorie GetCategorie(int id) { CategorieQuery pq = new CategorieQuery(contexte); return(pq.GetById(id).FirstOrDefault()); }