1 pièce(s) jointe(s)
Entity Framework 5 : Update One to many
Salut à tous !
J'aimerais savoir comment update mes chèques de ma BDD quand j'update un Customer lié en One to Many.
Voici ma BDD :
Pièce jointe 215120
And voici ce que j'ai fais :
Code:
1 2 3 4 5 6 7 8 9 10 11
| using (var context = new ConEntities())
{
var original = context.Customer.Include(p => p.Check).SingleOrDefault(s => s.id == customerToUpdate.id);
if (original != null)
{
context.Entry(original).CurrentValues.SetValues(customerToUpdate);
context.SaveChanges();
}
} |
Je n'ai pas d'erreur, mon Customer s'update bien, mais pas ses chèques, comment faire ?
Merci