private void AddDepartment() { var viewModel = new DepartmentViewModel(new Department()); if (_dialogService.ShowDialog(viewModel) == true) { Departments.Add(_repository.GetDepartmentDto(viewModel.Department.Id)); } }
private void EditDepartment(DepartmentDto departmentDto) { Department department = _repository.GetById(departmentDto.Id); var viewModel = new DepartmentViewModel(department); if (_dialogService.ShowDialog(viewModel) == true) { int index = Departments.IndexOf(departmentDto); Departments[index] = _repository.GetDepartmentDto(viewModel.Department.Id); } }