Example #1
0
        public async Task <IResultModel> Query(ModuleInfoQueryModel model)
        {
            var result = new QueryResultModel <ModuleInfo>();
            var paging = model.Paging();

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

            result.Total = paging.TotalCount;
            return(ResultModel.Success(result));
        }
Example #2
0
        public async Task <IResultModel> Query(ModuleInfoQueryModel model)
        {
            var result = new QueryResultModel <ModuleInfoEntity>
            {
                Rows  = await _repository.Query(model),
                Total = model.TotalCount
            };

            return(ResultModel.Success(result));
        }
Example #3
0
        public async Task <IList <ModuleInfoEntity> > Query(ModuleInfoQueryModel model)
        {
            var paging = model.Paging();
            var query  = Db.Find();

            query.WhereIf(model.Name.NotNull(), m => m.Name.Contains(model.Name));
            query.WhereIf(model.Code.NotNull(), m => m.Code.Contains(model.Code));

            if (!paging.OrderBy.Any())
            {
                query.OrderByDescending(m => m.Id);
            }

            var list = await query.LeftJoin <AccountEntity>((x, y) => x.CreatedBy == y.Id)
                       .Select((x, y) => new { x, Creator = y.Name })
                       .PaginationAsync(paging);

            model.TotalCount = paging.TotalCount;
            return(list);
        }
 public Task <IResultModel> Query([FromQuery] ModuleInfoQueryModel model)
 {
     return(_service.Query(model));
 }