public UnitController() { unitList = SchoolDBAAdapter.FetchAllUnit();//load all units to local viewableUnit = new ObservableCollection <Unit>(unitList); foreach (Unit i in unitList) { i.classList = SchoolDBAAdapter.FetchClassByCode(i.Code); } }
public void FilterByCampus(string code, Campus cam) { Campus all = ParseEnum <Campus>("All"); classList = SchoolDBAAdapter.FetchClassByCode(code); viewableClass = new ObservableCollection <UnitClass>(classList); if (cam != all) { var SearchtName = from UnitClass uc in classList where (uc.Campus == cam) select uc; viewableClass.Clear(); SearchtName.ToList().ForEach(viewableClass.Add); } }