private async void BindDataDepartmentcBox() { try { Department department = _departmentProxy.GetDepartmentById(MainWindow.Employee.DepartmentId); CBoxDepartment.ItemsSource = await _departmentProxy.GetAllDepartmentsByWorkplaceIdAsync(department.WorkplaceId); CBoxDepartment.DisplayMemberPath = "Name"; } catch (Exception) { MessageBox.Show("Something went wrong! Could not fetch departments"); } }
private async void LoadDepartmentList() { try { Department department = await departmentProxy.GetDepartmentByIdAsync(MainWindow.Employee.DepartmentId); List <Department> departments = await departmentProxy.GetAllDepartmentsByWorkplaceIdAsync(department.WorkplaceId); CBoxDepartment.ItemsSource = departments; CBoxDepartment.DisplayMemberPath = "Name"; } catch (Exception) { MessageBox.Show("Something went wrong! Could net fetch department"); } }