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); }
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)); }
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); }