// GET api/usergroupapi public IEnumerable <CUserGroup> Get() { var user = (CSign)HttpContext.Current.Session[ConfigurationManager.AppSettings["AuthSaveKey"]]; if (user == null) { throw new HttpResponseException(new SiginFailureMessage()); } using (var dal = DalBuilder.CreateDal(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, 0)) { CUserGroup[] userGroups; try { dal.Open(); userGroups = UserGroupBll.List(dal); dal.Close(); } catch (Exception ex) { LogBll.Write(dal, new CLog { LogUser = string.Format("{0}-{1}", user.UserCode, user.UserName), LogContent = string.Format("{0}#{1}", "UserGroup.List", ex.Message), LogType = LogType.系统异常 }); throw new HttpResponseException(new SystemExceptionMessage()); } if (userGroups == null) { throw new HttpResponseException(new DataNotFoundMessage()); } return(userGroups); } }