예제 #1
0
        public IEnumerable <SystemRole> Search(Expression <Func <SystemRole, bool> > whereExpressions, PageOptions page)
        {
            var query = whereExpressions == null?RoleDb.AsQueryable() : RoleDb.AsQueryable().Where(whereExpressions);

            if (!page.IsNull() && page.IsValidate)
            {
                var totalCount = 0;
                var results    = query.ToPageList(page.PageIndex, page.PageSize, ref totalCount);
                page.TotalCount = totalCount;

                return(results);
            }
            else
            {
                return(query.ToList());
            }
        }
예제 #2
0
 public async Task <SystemRole> GetById(Guid id)
 {
     return(await RoleDb.AsQueryable().FirstAsync(r => r.RoleId == id));
 }