public void LoadFromDao(captor c) { CaptorId = c.captorId; Serial_number = c.serial_number; Description = c.description; Localisation = c.localisation; }
public captor ConvertToDao() { captor c = new captor(); c.captorId = CaptorId; c.serial_number = Serial_number; c.description = Description; c.localisation = Localisation; return(c); }
static void Main(string[] args) { ClearDb(); projet4Entities ctx = new projet4Entities(); MCaptor mc = new MCaptor(); mc.Serial_number = "482"; mc.Localisation = "ici"; mc.Description = "plop"; captor cpt = mc.ConvertToDao(); ctx.captor.Add(cpt); ctx.SaveChanges(); Console.WriteLine("capteur : id {0} ajouté !", cpt.captorId); Console.ReadLine(); }