public IHttpActionResult GetAllRoles() { ResultEntity result = new ResultEntity(); List <RoleEntity> roles = new List <RoleEntity>(); try { roles = dal.FindAllRoles().ToList <ROLE>().ConvertAll <RoleEntity>(r => r.ToRoleEntity()); } catch (Exception e) { result.Message = e.Message; NtripProxyLogger.LogExceptionIntoFile("调用接口api/Role/GetAllRoles异常,异常信息为:" + e.Message); } result.IsSuccess = result.Message == null; result.Data = roles; return(Json <ResultEntity>(result)); }