public List <ListGrade> AjaxQuery(GradesRequest request) { var data = new List <ListGrade>(); var query = IGradesService.Query(request); if (query != null) { var roles = _securityHelper.GetCurrentUser().CurrentUser.Roles.ToList(); data = query.ModelList.Select(x => new ListGrade(x)).ToList(); foreach (var item in data) { if (roles[0].IsSuper || roles[0].Permissions.Contains("EditGrades")) { item.boor += "<a href='#' onclick=OperatorThis('Edit','/Grades/Edit/" + item.gradeId + "') class='tablelink'>编辑 </a> "; } if (roles[0].IsSuper || roles[0].Permissions.Contains("DeleteGrades")) { item.boor += "<a href='#' onclick=OperatorThis('Delete','/Grades/Delete/" + item.gradeId + "') class='tablelink'>删除 </a> "; } } pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount); } else { pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0); } return(data); }
public void Query() { var request = new GradesRequest(); var query = IGradesService.Query(request); if (query != null) { List = query.ModelList.Select(x => new ListGrade(x)).ToList(); pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount); } else { List = new List <ListGrade>(); pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0); } }