// // Fonction de création d'une commande // public bool createCommande(CommandesEntity commande) { using (var context = new MADERA_V1Entities()) { MDR_Commandes addCommandes = new MDR_Commandes(); addCommandes.Comma_Actif = 1; addCommandes.Comma_Prix = commande.Comma_Prix; try { context.MDR_Commandes.Add(addCommandes); context.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
// // Fonction de suppression d'une commande // public bool disabledCommande(int IdCommande) { using (var context = new MADERA_V1Entities()) { MDR_Commandes updatingCommande = (from c in context.MDR_Commandes where c.Comma_Index == IdCommande select c).SingleOrDefault(); updatingCommande.Comma_Index = 0; try { context.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }
// // Fonction d'udpadte d'une commande // public bool updateCommande(CommandesEntity commande) { using (var context = new MADERA_V1Entities()) { MDR_Commandes updatingCommande = (from c in context.MDR_Commandes where c.Comma_Index == commande.Comma_Index select c).SingleOrDefault(); updatingCommande.Comma_Actif = commande.Comma_Actif; updatingCommande.Comma_Prix = commande.Comma_Prix; try { context.SaveChanges(); return(true); } catch (Exception e) { return(false); } } }