예제 #1
0
        //
        // CREATE
        //
        public bool createModele(ModelesEntity modele)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Modeles addModeles = new MDR_Modeles();

                addModeles.Model_Actif = 1;
                addModeles.Model_Nom   = modele.Model_Nom;

                try
                {
                    context.MDR_Modeles.Add(addModeles);
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
예제 #2
0
        //
        // DELETE
        //
        public bool disabledModele(int IdModele)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Modeles addModeles = (from m in context.MDR_Modeles
                                          where m.Model_Index == IdModele
                                          select m).SingleOrDefault();

                addModeles.Model_Actif = 0;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
예제 #3
0
        //
        // UPDATE
        //
        public bool updateModele(ModelesEntity modele)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Modeles addModeles = (from m in context.MDR_Modeles
                                          where m.Model_Index == modele.Model_Index
                                          select m).SingleOrDefault();

                addModeles.Model_Actif = modele.Model_Actif;
                addModeles.Model_Nom   = modele.Model_Nom;
                addModeles.Model_Index = modele.Model_Index;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }