예제 #1
0
 static void GetCivilitesById(int id)
 {
     using (GestContactEntities entities = new QuatriemeApplication.GestContactEntities())
     {
         var maCivilite = entities.Civilites.SingleOrDefault(civilite => civilite.Id == id);
     }
 }
예제 #2
0
 static void UpdateCiviliteInORM(int id, string libelleCourt, string libelleLong)
 {
     using (GestContactEntities entities = new QuatriemeApplication.GestContactEntities())
     {
         var maCivilite = entities.Civilites.SingleOrDefault(civilite => civilite.Id == id);
         maCivilite.LibelleCourt = libelleCourt;
         maCivilite.LibelleLong  = libelleLong;
         entities.SaveChanges();
     }
 }
예제 #3
0
 static void ListCivilites()
 {
     using (GestContactEntities entities = new QuatriemeApplication.GestContactEntities())
     {
         foreach (var item in entities.Civilites)
         {
             Console.WriteLine($"{item.Id}, {item.LibelleCourt}, {item.LibelleLong}");
         }
     }
 }
예제 #4
0
 static void InsertCiviliteInORM(string libelleCourt, string libelleLong)
 {
     using (GestContactEntities entities = new QuatriemeApplication.GestContactEntities())
     {
         var maCivilite = new QuatriemeApplication.Civilite()
         {
             LibelleCourt = libelleCourt, LibelleLong = libelleLong
         };
         entities.Civilites.Add(maCivilite);
         entities.SaveChanges();
     }
 }