示例#1
0
        public async Task <IList <RoleEntity> > Query(RoleQueryModel model)
        {
            var paging = model.Paging();
            var query  = Db.Find(m => m.Deleted == false);

            var list = await query.PaginationAsync(paging);

            model.TotalCount = paging.TotalCount;
            return(list);
        }
示例#2
0
        public async Task <IResultModel> Query(RoleQueryModel model)
        {
            var result = new QueryResultModel <Role>();
            var paging = model.Paging();

            result.Rows = await _repository.Query(paging, model.Name);

            result.Total = paging.TotalCount;
            return(ResultModel.Success(result));
        }
示例#3
0
        public async Task <IList <RoleEntity> > Query(RoleQueryModel model)
        {
            var paging = model.Paging();
            var query  = Db.Find().LeftJoin <AccountEntity>((x, y) => x.CreatedBy == y.Id);

            query.WhereIf(model.Name.NotNull(), (x, y) => x.Name.Contains(model.Name));
            query.Select((x, y) => new { x, Creator = y.Name });
            var list = await query.PaginationAsync(paging);

            model.TotalCount = paging.TotalCount;
            return(list);
        }