private void ButtonUpdatePartner_Click(object sender, RoutedEventArgs e) { Partner partner = (Partner)ListPartner.SelectedItem; if (partner != null) { PartnerWindow partnerWindow = new PartnerWindow(db); partnerWindow.DataContext = partner; partnerWindow.ShowDialog(); if (partnerWindow.DialogResult == true) { db.SaveChanges(); } } else { MessageBox.Show("Veuillez sélectionner un partenaire de diffusion."); } }
private void ButtonAddPartner_Click(object sender, RoutedEventArgs e) { Partner partner = new Partner(); partner.Account = new Account(); PartnerWindow partnerWindow = new PartnerWindow(db); partnerWindow.DataContext = partner; partnerWindow.ShowDialog(); if (partnerWindow.DialogResult == true) { Partners.Add(partner); db.Partner.Add(partner); db.SaveChanges(); } }