public IActionResult ModuleElement(Guid moduleId, int?pageIndex = 1, int?pageSize = 10) { int pcount; var model = _moduleElementRepository.GetPage(s => s.ModuleId == moduleId, pageIndex.Value, pageSize.Value, out pcount); ViewBag.PageSize = pageSize.Value; ViewBag.TotalCount = pcount; ViewBag.moduleId = moduleId; return(View(model)); }
public virtual IActionResult Settab(Guid cid, int?pageIndex = 1, int?pageSize = 200) { var column = _repository.Find(cid); string tab = column.Tab; if (!string.IsNullOrEmpty(tab)) { var listTab = Newtonsoft.Json.JsonConvert.DeserializeObject <List <TabsViewModel> >(tab); ViewData["listTab"] = listTab; } int pcount = 0; IQueryable <IndexRecommendEntity> model = null; switch (column.DataSource.Value) { case (int)E_Column_DataSource.自定义: model = _indexRecommend.GetPage(s => s.ColumnId.Equals(cid) && s.Type == (int)E_Column_DataSource.自定义, pageIndex.Value, pageSize.Value, out pcount); break; default: break; } ViewBag.PageSize = pageSize.Value; ViewBag.TotalCount = pcount; ViewBag.cid = column.Id; ViewBag.dataSoruce = column.DataSource; return(View(model)); }
public IQueryable <ModuleEntity> Search(string name, Guid?pid, int?pageIndex = 1, int?pageSize = 10) { try { //构建表达式 Expression <Func <ModuleEntity, bool> > filter = s => true; if (!string.IsNullOrEmpty(name)) { filter = filter.And(s => s.Name.Equals(name)); } if (pid != null) { filter = filter.And(s => s.Pid == pid); } int pcount; var result = _repositoryEF.GetPage(filter, pageIndex.Value, pageSize.Value, out pcount); ViewBag.PageSize = pageSize.Value; ViewBag.TotalCount = pcount; return(result); ////s => s.Name.Equals(name) && s.Pid == pid //ParameterExpression parameter = Expression.Parameter(typeof(ModuleEntity), "s"); //BinaryExpression leftBinary = null, rightBinary = null; //if (!string.IsNullOrEmpty(name)) //{ // var pName = typeof(ModuleEntity).GetProperty("Name"); // MemberExpression property = Expression.MakeMemberAccess(parameter, pName); // ConstantExpression constant = Expression.Constant(name); // leftBinary = Expression.MakeBinary(ExpressionType.Equal, property, constant); //} //if (pid != null) //{ // var pPid = typeof(ModuleEntity).GetProperty("Pid"); // MemberExpression property = Expression.MakeMemberAccess(parameter, pPid); // ConstantExpression constant = Expression.Constant(pid); // var r = Expression.Convert(constant, property.Type); // rightBinary = Expression.MakeBinary(ExpressionType.Equal, property, r); //} //var binary = Expression.AndAlso(leftBinary, rightBinary); //LambdaExpression lambda = Expression.Lambda(binary, parameter); //var model = _repositoryEF.GetPage(s => s.Name.Equals(name) && s.Pid == pid, pageIndex.Value, pageSize.Value, out pcount); //ViewBag.PageSize = pageSize.Value; //ViewBag.TotalCount = pcount; //return model; } catch (Exception ex) { throw; } }
private IQueryable <RoleEntity> SearchData(string name, int?pageIndex = 1, int?pageSize = 10) { Expression <Func <RoleEntity, bool> > filter = s => true; if (!string.IsNullOrEmpty(name)) { filter = filter.And(s => s.Name.Equals(name)); } int pcount; var result = _repositoryEF.GetPage(filter, pageIndex.Value, pageSize.Value, out pcount); ViewBag.PageSize = pageSize.Value; ViewBag.TotalCount = pcount; return(result); }