private void EditUser() { var editedEmployee = _employees[_mainView.dataGridViewUsers.CurrentRow.Index]; var view = new Employees.Views.EmployeeView(); view.SetObjectToEdit = editedEmployee; if (indexNumber == _mainView.dataGridViewUsers.CurrentRow.Index) { if (view.ShowDialog() == DialogResult.OK) { var selectedEmlpoyee2 = view.SetObjectToEdit; RefreshView(); } } else { MessageBox.Show("Nie można edytować innego użytkownika"); } }
private void AddNewUser() { var newEmployee = new Employee(); var view = new Employees.Views.EmployeeView(); view.SetObjectToEdit = newEmployee; // gdy result jest ok to zapisuje if (view.ShowDialog() == DialogResult.OK) { var newEmployee2 = view.SetObjectToEdit; Task.Run(async() => { await _mainViewModel.Add(newEmployee2); }).Wait(); RefreshView(); } }