public IEnumerable <TreeData> getLocationTree(int bId) { using (AssetManagementEntities entities = new AssetManagementEntities()) { List <TreeData> locationFilter = new List <TreeData>(); try { var locations = entities.asm_getLocationTree(bId); foreach (var loc in locations) { locationFilter.Add(new TreeData { id = loc.id, text = loc.text, parent = loc.parent }); } return(locationFilter); } catch (Exception e) { } return(locationFilter); } }