public PaginatedResult<User> SearchUsers(SearchUserCriteria criteria)
 {
     AbstractCriterion left = Restrictions.Or(
                         Restrictions.On<User>(u => u.Username).IsLike("%" + criteria.Keyword + "%"),
                         Restrictions.On<User>(u => u.Email).IsLike("%" + criteria.Keyword + "%"));
     AbstractCriterion right = Restrictions.Or(
                         Restrictions.On<User>(u => u.FirstName).IsLike("%" + criteria.Keyword + "%"),
                         Restrictions.On<User>(u => u.LastName).IsLike("%" + criteria.Keyword + "%"));
     var queryOver = QueryOver.Of<User>().Where(Restrictions.Or(left, right));
     return repository.Find<User>(queryOver, criteria.PageIndex, criteria.PageSize, criteria.OrderBy.ToArray());
 }
        public ActionResult Index(int? page, string keywords)
        {
            SearchUserCriteria criteria = new SearchUserCriteria();
            criteria.PageIndex = page.HasValue ? page.Value - 1 : 0;
            criteria.PageSize = systemService.GetConfig<int>(Constants.Settings.DefaultPageSize, 10);
            criteria.OrderBy.Add(OrderBy.Asc("Id"));
            criteria.Keyword = keywords;

            PaginatedResult<User> results = userService.SearchUsers(criteria);
            UserListInfo info = new UserListInfo(criteria.PageIndex, criteria.PageSize, results);
            info.Keywords = keywords;

            return View(info);
        }