public ResponseRoleGet RoleGet([FromBody] RequestRoleGet request) { try { RoleBLL bll = new RoleBLL(); return(bll.RoleGet(request)); } catch (Exception ex) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public ResponseRoleGet RoleGet(RequestRoleGet request) { ResponseRoleGet response = new ResponseRoleGet(); using (cnn = GetConnection()) { try { var user = cnn.QuerySingle <TKS_FAS_Role>("select * from tks_fas_role where id=@Id", new { Id = request.Data.Id }); var Role2Permission = cnn.Query <TKS_FAS_Role2Permission>("select * from TKS_FAS_Role2Permission where RoleId=@RoleId", new { RoleId = request.Data.Id }).ToList(); var Permission = cnn.Query <TKS_FAS_Role2PermissionExt>("select * from TKS_FAS_PermissionInfo", null).ToList(); List <TKS_FAS_Role2PermissionExt> ptRoles = new List <TKS_FAS_Role2PermissionExt>(); foreach (var item in Permission) { if (Role2Permission.Any(p => p.Permission == item.Permission)) { item.IsChecked = true; } else { item.IsChecked = false; } ptRoles.Add(item); } RoleInfo roleInfo = new RoleInfo(); roleInfo.Data = user; roleInfo.lstRole2Permission = ptRoles; response.IsSuccess = true; response.Message = "加载完毕"; response.Data = roleInfo; return(response); } catch (Exception ex) { return(this.DealException(response, ex) as ResponseRoleGet); } } }