コード例 #1
0
ファイル: RoleService.cs プロジェクト: xiaopohou/MicroAngels
        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
ファイル: RoleService.cs プロジェクト: xiaopohou/MicroAngels
 public async Task <SystemRole> GetById(Guid id)
 {
     return(await RoleDb.AsQueryable().FirstAsync(r => r.RoleId == id));
 }