public Form1()
        {
            InitializeComponent();
            dateTimePickerOEBDate.MaxDate = DateTime.Today;

            EfContext efContext = new EfContext();

            branchBindingSource.DataSource = efContext.Branches.ToList();

            List <Branch> branches = efContext.Branches.Include(b => b.Teachers).ToList();

            comboBoxOEBrans.DataSource = branches;
            efContext.Dispose();
        }
        private void buttonBEkleme_Click(object sender, EventArgs e)
        {
            Branch branch = new Branch
            {
                Name = textBoxBEkleme.Text
            };

            EfContext efContext = new EfContext();

            efContext.Branches.Add(branch);

            try
            {
                efContext.SaveChanges();
                MessageBox.Show("Kaydedildi");
            }
            catch (Exception exception)
            {
                MessageBox.Show("Kaydedilmedi");
            }

            efContext.Dispose();
        }