/// <summary>
        /// 服务器列表分页
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public async Task <PaginatedItemsVM <ServerListDTO> > GetServerList(PagePara para)
        {
            var query = _dbContext.ServerList.AsQueryable();

            if (!string.IsNullOrEmpty(para.Search_Name))
            {
                query.Where(m => m.ServerName.Contains(para.Search_Name));
            }

            if (!string.IsNullOrEmpty(para.Search_Description))
            {
                query.Where(m => m.Description.Contains(para.Search_Description));
            }

            var totalCount = query.Count();

            if (totalCount == 0)
            {
                return(new PaginatedItemsVM <ServerListDTO>(totalCount, new List <ServerListDTO>()));
            }

            var list = await query.Skip(para.Limit)
                       .Take(para.Offset)
                       .Select(x => new ServerListDTO {
                ServerName      = x.ServerName,
                ServerAuthority = x.ServerAuthority,
                ServerId        = x.ServerId,
                Description     = x.Description
            }).ToListAsync();

            return(new PaginatedItemsVM <ServerListDTO>(totalCount, list));
        }
示例#2
0
        /// <summary>
        /// 获取操作日志
        /// </summary>
        /// <param name="pagePara">查询条件</param>
        /// <returns></returns>
        public async Task <IActionResult> GetList([FromQuery] PagePara pagePara)
        {
            var getResult = await _operationalLogServices.GetListPagedAsync(Specification <OperationalLog> .Eval(d => 1 == 1), d => d.OperationalTime, SortOrder.Ascending, pagePara.Page, pagePara.Limit);

            var menuList = getResult.data.Select(d => new OperationalLogList {
                Id = d.Id,
                OperationalName  = d.OperationalName,
                Controller       = d.Controller,
                Action           = d.Action,
                OperationalIp    = d.OperationalIp,
                OperationalState = d.OperationalState,
                OperationalTime  = d.OperationalTime,
                UserName         = d.UserManager?.RealName
            }).ToList();

            return(Json(new PageResult <OperationalLogList>
            {
                code = getResult.code,
                msg = getResult.msg,
                count = getResult.count,
                data = menuList
            }));
        }
        public async Task <IActionResult> GetUserList(PagePara para)
        {
            var model = await _userAdminService.GetUserList(para);

            return(Json(new { total = model.Count, rows = model.Data }));
        }
 /// <summary>
 /// 服务器列表分页
 /// </summary>
 /// <param name="para"></param>
 /// <returns></returns>
 public async Task <PaginatedItemsVM <ServerListDTO> > GetServerList(PagePara para)
 {
     return(await _iserverlistrepository.GetServerList(para));
 }
 /// <summary>
 /// 用户列表分页
 /// </summary>
 /// <param name="para"></param>
 /// <returns></returns>
 public async Task <PaginatedItemsVM <UserDTO> > GetUserList(PagePara para)
 {
     return(await _iuserrepository.GetUserList(para));
 }