private void Btn_Accept(object sender, RoutedEventArgs e) { if (person == 1) { _addedClient.Name = textBoxName.Text; _addedClient.Surname = textBoxSurname.Text; _addedClient.Middlename = textBoxMiddlename.Text; _addedClient.PhoneNumber = textBoxPhoneNumber.Text; _addedClient.Address = textBoxAddress.Text; _addedClient.DateOfBirth = (DateTime)birthDatePicker.SelectedDate; ClientRepository.AddPart(_addedClient); } else if (person == 2) { _addedEmployee.Name = textBoxName.Text; _addedEmployee.Surname = textBoxSurname.Text; _addedEmployee.Middlename = textBoxMiddlename.Text; _addedEmployee.PhoneNumber = textBoxPhoneNumber.Text; _addedEmployee.Address = textBoxAddress.Text; _addedEmployee.DateOfBirth = (DateTime)birthDatePicker.SelectedDate; EmployeeRepository.AddPart(_addedEmployee); } this.Close(); }