public Produit ajouterProduit(Produit p) { using (var db = new Dao.ProjetContext()) { db.produits.Add(p); db.SaveChanges(); Panier pan = new Panier(); pan.NombreProduits = 0; pan.PrixTotal = 0; db.paniers.Add(pan); db.SaveChanges(); ProduitCommande pc = new ProduitCommande(); pc.PanierId = pan.PanierId; pc.ProduitId = p.ProduitId; pc.quantite = 20; db.produitCommandes.Add(pc); db.SaveChanges(); return(p); } }
public ICollection <Promotion> findAllPromotion() { using (var db = new Dao.ProjetContext()) { return(db.promotions.ToList()); } }
public Abonnement afficherAbonnement(int AbonnementId) { using (var db = new Dao.ProjetContext()) { return(db.abonnements.Find(AbonnementId)); } }
public Utilisateur afficherCompte(int UtilisateurId) { using (var db = new Dao.ProjetContext()) { return(db.utilisateurs.Find(UtilisateurId)); } }
public ICollection <Produit> listerProduits() { using (var db = new Dao.ProjetContext()) { return(db.produits.ToList()); } }
public Promotion findPromotionbyId(int id) { using (var db = new Dao.ProjetContext()) { return(db.promotions.Find(id)); } }
public Utilisateur rechercherUtilisateurById(int UtilisateurId) { using (var db = new Dao.ProjetContext()) { return(db.utilisateurs.Find(UtilisateurId)); } }
public Catalogue afficherCatalogue(int CatalogueId) { using (var db = new Dao.ProjetContext()) { return(db.catalogues.Find(CatalogueId)); } }
public ICollection <Client> listerClient() { using (var db = new Dao.ProjetContext()) { return(db.clients.ToList()); } }
public Panier findPanier(int PanierId) { using (var db = new Dao.ProjetContext()) { return(db.paniers.Find(PanierId)); } }
public ICollection <Produit> rechercherProduits(decimal prixMin, decimal prixMax) { using (var db = new Dao.ProjetContext()) { if (prixMin < prixMax) { var res = from p in db.produits where p.Prix >= prixMin && p.Prix <= prixMax select p; if (res.Count() != 0) { return(res.ToList()); } else { return(listerProduits()); } } else { return(listerProduits()); } } }
public Adresse afficherAdresse(int AdresseId) { using (var db = new Dao.ProjetContext()) { return(db.adresses.Find(AdresseId)); } }
public Produit afficherProduit(int ProduitId) { using (var db = new Dao.ProjetContext()) { return(db.produits.Find(ProduitId)); } }
public void modifierCatalogue(Catalogue c) { using (var db = new Dao.ProjetContext()) { db.Entry(c).State = EntityState.Modified; db.SaveChanges(); } }
public void modifierLigneCommande(ProduitCommande p) { using (var db = new Dao.ProjetContext()) { db.Entry(p).State = EntityState.Modified; db.SaveChanges(); } }
public Commande modifierCommande(Commande c) { using (var db = new Dao.ProjetContext()) { db.Entry(c).State = EntityState.Modified; db.SaveChanges(); return(c); } }
public Abonnement creerAbonnement(Abonnement a) { using (var db = new Dao.ProjetContext()) { db.abonnements.Add(a); db.SaveChanges(); return(a); } }
public Promotion creerPromotion(Promotion p) { using (var db = new Dao.ProjetContext()) { db.promotions.Add(p); db.SaveChanges(); return(p); } }
public void supprimerPanier(int PanierId) { using (var db = new Dao.ProjetContext()) { var res = db.paniers.Find(PanierId); db.paniers.Remove(res); db.SaveChanges(); } }
public Panier ajouterPanier(Panier p) { using (var db = new Dao.ProjetContext()) { db.paniers.Add(p); db.SaveChanges(); return(p); } }
public void supprimerLigneDeCommande(int ProduitId, int PanierId) { using (var db = new Dao.ProjetContext()) { var res = db.produitCommandes.Find(ProduitId, PanierId); db.produitCommandes.Remove(res); db.SaveChanges(); } }
public Promotion modifierPromotion(Promotion p) { using (var db = new Dao.ProjetContext()) { db.Entry(p).State = EntityState.Modified; db.SaveChanges(); return(p); } }
public ProduitCommande ajouterLigneDeCommande(ProduitCommande p) { using (var db = new Dao.ProjetContext()) { db.produitCommandes.Add(p); db.SaveChanges(); return(p); } }
public void supprimerPromotion(int PromotionId) { using (var db = new Dao.ProjetContext()) { var res = db.promotions.Find(PromotionId); db.promotions.Remove(res); db.SaveChanges(); } }
public void desactiverMonCompte(int idClient) { using (var db = new Dao.ProjetContext()) { Client c = db.clients.Find(idClient); c.CompteASupprimer = true; db.SaveChanges(); } }
public Avis_ClientProduit ajouterAvis(Avis_ClientProduit comm) { using (var db = new Dao.ProjetContext()) { db.avis_clientProduits.Add(comm); db.SaveChanges(); return(comm); } }
public Adresse ajouterAdresse(Adresse a) { using (var db = new Dao.ProjetContext()) { db.adresses.Add(a); db.SaveChanges(); return(a); } }
public void supprimerAdresse(int AdresseId) { using (var db = new Dao.ProjetContext()) { var res = db.adresses.Find(AdresseId); db.adresses.Remove(res); db.SaveChanges(); } }
public void supprimerAbonnement(int AbonnementId) { using (var db = new Dao.ProjetContext()) { var res = db.abonnements.Find(AbonnementId); db.abonnements.Remove(res); db.SaveChanges(); } }
public Adresse modifierAdresse(Adresse a) { using (var db = new Dao.ProjetContext()) { db.Entry(a).State = EntityState.Modified; db.SaveChanges(); return(a); } }