Example #1
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            CollegeDialog collegeDialog = new CollegeDialog()
            {
                Title = "Adicionar Universidade"
            };

            if (collegeDialog.ShowDialog() == true)
            {
                colleges.Add(DbContextHelper.AddCollege(_db, collegeDialog.College));
                collegeGrd.SelectedIndex = collegeGrd.Items.Count - 1;
            }
        }
Example #2
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            College collegeEdit = collegeGrd.SelectedItem as College;

            if (collegeEdit == null)
            {
                return;
            }
            CollegeDialog collegeDialog = new CollegeDialog(new College(collegeEdit))
            {
                Title = "Editar Universidade"
            };

            if (collegeDialog.ShowDialog() == true)
            {
                DbContextHelper.EditCollege(_db, collegeDialog.College);
            }
        }