//Permet de mettre a jour une catégorie dans la BDD public void UpdateType_Produit(Type_Produit type_produit) { using (var context = new BBFRContext()) { context.Entry(type_produit).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
//Methode pour sauvegarder un produit public void SaveProduit(Produit produit) { using (var context = new BBFRContext()) { context.Entry(produit.Type_Produit).State = EntityState.Unchanged; context.Produits.Add(produit); context.SaveChanges(); } }
//methode pour mettre a jour le statut de commande depuis le bouton de validation des commande/Détails public bool UpdateCommandeStatut(int ID, string statut) { using (var context = new BBFRContext()) { var commande = context.Commandes.Find(ID); commande.Statut = statut; context.Entry(commande).State = EntityState.Modified; return(context.SaveChanges() > 0); } }