static void GetCivilitesById(int id) { using (GestContactEntities entities = new QuatriemeApplication.GestContactEntities()) { var maCivilite = entities.Civilites.SingleOrDefault(civilite => civilite.Id == id); } }
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(); } }
static void ListCivilites() { using (GestContactEntities entities = new QuatriemeApplication.GestContactEntities()) { foreach (var item in entities.Civilites) { Console.WriteLine($"{item.Id}, {item.LibelleCourt}, {item.LibelleLong}"); } } }
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(); } }