コード例 #1
0
        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.");
            }
        }
コード例 #2
0
        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();
            }
        }