Beispiel #1
0
        public async Task <IResultModel> Query(IDCARDQueryModel model)
        {
            var result = new QueryResultModel <IDCARDEntity>
            {
                Rows  = await _repository.Query(model),
                Total = model.TotalCount
            };

            return(ResultModel.Success(result));
        }
        public async Task <IList <IDCARDEntity> > Query(IDCARDQueryModel model)
        {
            var paging = model.Paging();

            var query = Db.Find(m => m.ProjectId.Contains(model.ProjectId) && m.CardNum.Contains(model.CardNum));

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