public async Task <IResultModel> Query(AttachmentQueryModel model)
        {
            var result = new QueryResultModel <AttachmentEntity>
            {
                Rows  = await _repository.Query(model),
                Total = model.TotalCount
            };

            return(ResultModel.Success(result));
        }
        public async Task <IList <AttachmentEntity> > Query(AttachmentQueryModel model)
        {
            var conditions = await _filter.GetConditions <AttachmentEntity, AttachmentQueryModel>(model);

            var query = _dbContext.Db.Queryable <AttachmentEntity>()
                        .Where(conditions)
                        .OrderBy(model.OrderFileds);

            RefAsync <int> totalCount = 0;
            var            data       = await query.ToPageListAsync(model.PageIndex, model.PageSize, totalCount);

            model.TotalCount = totalCount;

            return(data);
        }
예제 #3
0
        public async Task <IList <AttachmentEntity> > Query(AttachmentQueryModel model)
        {
            var paging = model.Paging();

            var query = Db.Find();

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

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

            var result = 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(result);
        }
예제 #4
0
 public Task <IResultModel> Query([FromQuery] AttachmentQueryModel model)
 {
     return(_service.Query(model));
 }