Esempio n. 1
0
        public async Task <ReturnPagin <List <ReturnDepartmentDto> > > QueryAsync(SelectDeparmentDto model)
        {
            var result      = new ReturnPagin <List <ReturnDepartmentDto> >();
            var departments = _context.Departments.AsNoTracking();

            result.Items = await departments.Select(i => new ReturnDepartmentDto()
            {
                CreateTime = i.CreateTime,
                Id         = i.Id,
                LastUpTime = i.LastUpTime,
                Name       = i.Name
            }).ToListAsync();

            result.Page   = model.Page;
            result.Number = model.Number;
            result.Count  = result.Items.Count;
            return(result);
        }
        public async Task <IActionResult> QueryPaginAsync(SelectDeparmentDto model)
        {
            var result = await _service.QueryAsync(model);

            return(Ok(result));
        }