Esempio n. 1
0
        public async Task <IActionResult> QueryPaginAsync(SelectStaffinfoDto model)
        {
            var result = await _service.QueryPaginAsync(model);

            return(Ok(result));
        }
        public async Task <ReturnPagin <List <ReturnStaffinfoDto> > > QueryPaginAsync(SelectStaffinfoDto model)
        {
            var result = new ReturnPagin <List <ReturnStaffinfoDto> >();

            var staffInfos = _context.StaffInfos.Include(i => i.Position).AsNoTracking();

            result.Items = await staffInfos.OrderByDescending(i => i.CreateTime).Pagin(model).Select(i => new ReturnStaffinfoDto
            {
                Id              = i.Id,
                Email           = i.Email,
                Name            = i.Name,
                EntryTime       = i.EntryTime,
                LastUpTime      = i.LastUpTime,
                Phone           = i.Phone,
                PositionName    = i.Position.Name,
                ResignationTime = i.ResignationTime,
                WorkingStatus   = i.WorkingStatus,
            }).ToListAsync();

            result.Count = await staffInfos.CountAsync();

            result.Number = model.Number;
            result.Page   = model.Page;
            return(result);
        }