Esempio n. 1
0
        public OpResult GetUserDataBySearchInfo(QueryInfo queryInfo, PageInfo pageInfo, out int totalCount)
        {
            IQueryable <User> query = null;

            if (queryInfo.Where.Count() > 0)
            {
                query = context.Users.Where(queryInfo.ToSQLString(), queryInfo.GetParams()).Where(s => s.IsDeleted != 1);
            }
            else
            {
                query = context.Users.Where(s => s.IsDeleted != 1);
            }
            totalCount = query.Count();
            var data   = query.OrderBy(s => s.Id).Skip((pageInfo.Page - 1) * pageInfo.Rows).Take(pageInfo.Rows);
            var result = new OpResult()
            {
                Successed = true, Data = data
            };

            return(result);
        }