private IDictionary <UnitType, List <object> > GetRoots(string userId) { var user = new UserService().Get(userId); var unitService = new UnitService(); var unit = unitService.Get(user.UnitId); if (unit.Type == UnitType.None) { return(null); } var dic = new Dictionary <UnitType, List <object> >(); if (unit.Type == UnitType.Hospital || unit.Type == UnitType.HospitalUnit) { var roots = unitService.GetByRootId(Constant.DEFAULT_UNIT_ROOT_ID); dic[UnitType.Hospital] = roots.Where(item => item.Type == UnitType.Hospital).Select(item => new { Id = item.Id, Name = item.Name }).ToList <object>(); } else { var vendor = new UnitService().Get(unit.RootId == Constant.DEFAULT_UNIT_ROOT_ID ? unit.Id : unit.RootId); dic[UnitType.Vendor] = new List <object>() { new { Id = vendor.Id, Name = vendor.Name } }; } return(dic); }