private static void AddDataCheckItems(DataCheckItemViewModel viewModel, DataCheckItem dataCheckItem, ILookup <int, DataCheckItem> groupedDataCheckItems, IOrderedEnumerable <int> parentIds) { var newViewModel = new DataCheckItemViewModel(dataCheckItem, viewModel); if (IsParent(dataCheckItem, parentIds)) { var newParentId = dataCheckItem.Id; foreach (var childItem in groupedDataCheckItems[newParentId]) { //child assigns parent --> automatically added to parent.Children! AddDataCheckItems(newViewModel, childItem, groupedDataCheckItems, parentIds); } } }
private static bool IsSavableDataItem(DataCheckItem item) { return(item.Id > 0); //below 1 are treeview root elements that are not saved }
public DataCheckItemViewModel(DataCheckItem dataCheckItem, DataCheckItemViewModel parent) : base(parent, /*lazyLoadChildren*/ false) { DataCheckItem = dataCheckItem; }
private static bool IsParent(DataCheckItem dataCheckItem, IOrderedEnumerable <int> parentIds) { return(IsParent(dataCheckItem.Id, parentIds)); }