日期:2014-05-17 浏览次数:20434 次
public ActionResult Search(int? page, string keywords) { AppendTitle("个人会员-搜索结果"); var q = QueryBuilder.Create<Persons>() .Like(x => x.UserName, keywords ?? string.Empty); var query1 = QueryBuilder.Create<Persons>() //多字段查询 .Like(x => x.PersonNum, keywords ?? string.Empty); q.Expression = q.Expression.Or(query1.Expression); int currentPageIndex = page.HasValue ? page.Value - 1 : 0; var persons = personsRepository.Find(q, currentPageIndex, BaseControllerService.PageSize, "PersonID", false); var viewModel = new PersonsIndexViewModel { Persons = persons, Keywords = keywords }; return View("Index", viewModel); }