Пример #1
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            EmployeeDialog employeeDialog = new EmployeeDialog()
            {
                Title = "Adicionar Funcionário"
            };

            if (employeeDialog.ShowDialog() == true)
            {
                employees.Add(DbContextHelper.AddEmployee(_db, employeeDialog.Employee, employeeDialog.Password));
                employeesGrd.SelectedIndex = employeesGrd.Items.Count - 1;
            }
        }
Пример #2
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            Employee employeeEdit = employeesGrd.SelectedItem as Employee;

            if (employeeEdit == null)
            {
                return;
            }
            EmployeeDialog employeeDialog = new EmployeeDialog(new Employee(employeeEdit))
            {
                Title = "Editar Funcionário"
            };

            if (employeeDialog.ShowDialog() == true)
            {
                DbContextHelper.EditEmployee(_db, employeeDialog.Employee);
            }
        }