/// <summary> /// to == null: toTop /// </summary> private void AddDpvm(DepartmentViewModel from, DepartmentViewModel to) { if (to == null) { TopDepartmentVMs.Add(from); } else { to.AddChildDepartment(from); } }
private void RemoveDepartment() { //move children to Top foreach (var childDpvm in SelectedDp.ChildrenDpvms) { childDpvm.ParentDpvm = null; TopDepartmentVMs.Add(childDpvm); } SelectedDp.ChildrenDpvms.Clear(); //remove RemoveDpvm(SelectedDp); Model.RemoveWithEntity(SelectedDp.Model); }