private void ModifPlan(ModifPlan value, SqlConnection connection) { Models.RemboursementDAO rbdao = new Models.RemboursementDAO(connection); rbdao.Delete("WHERE pret='" + value.pret.id + "'"); Models.Pret pret = new Models.Pret(value.pret); pret.Client = new Models.Client(); pret.Client.Id = value.pret.id; foreach (Remboursement r in value.remboursements) { Models.Remboursement rb = new Models.Remboursement(r); rb.Pret = pret; if (rb.Id == null) { rb.Id = rbdao.NextId(); } rbdao.Insert(rb); } }