/// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public async Task <DTO_PageableModel <DTOAPI_AppInfo> > getAppInfos(DTO_PageableQueryModel <DTOAPIReq_GetAppInfos> info)
        {
            DTO_PageableModel <DTOAPI_AppInfo> dto_model = new DTO_PageableModel <DTOAPI_AppInfo>();

            IQueryable <AppInfo> query = accesser.GetByAppName(info.data.appName);

            dto_model.data = query.OrderByDescending(x => x.Id).QueryPages(info.pageSize, info.pageNum).Select(x => mapper.Map <AppInfo, DTOAPI_AppInfo>(x)).ToArray();

            dto_model.total   = query.LongCount();
            dto_model.pageNum = info.pageNum;

            return(dto_model);
        }
예제 #2
0
        public async Task <IActionResult> GetUsers([FromBody] DTO_PageableQueryModel <DTO_GetUsers> queryInfo)
        {
            try
            {
                var model = await this.services.GetUsers(queryInfo).ConfigureAwait(false);

                return(JsonToCamelCase(model.data, _total: model.total, _pageNum: model.pageNum, _pageSize: model.pageSize));
            }
            catch (Exception ex)
            {
                return(JsonToCamelCase(ex.Message, 50000, 50000));
            }
        }
        public async Task <IActionResult> GetAppInfos([FromBody] DTO_PageableQueryModel <DTOAPIReq_GetAppInfos> info)
        {
            try
            {
                var data = await this.services.getAppInfos(info);

                return(JsonToCamelCase(data));
            }
            catch (Exception ex)
            {
                return(JsonToCamelCase(ex.Message, 50000, 50000, ex.Message));
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public  async Task<DTO_PageableModel<DTOAPIRes_UserInfo>> GetUsers(DTO_PageableQueryModel<DTO_GetUsers> query )
        {
            var users = await this.accesser.Get(query);
            
            DTO_PageableModel<DTOAPIRes_UserInfo> ret_model = new DTO_PageableModel<DTOAPIRes_UserInfo>
            {
                pageNum = users.pageNum,
                pageSize = users.pageSize,
                total = users.total,
                data = users.data.Select(x => 
                {
                    DTOAPIRes_UserInfo userInfo = this.mapper.Map<Account, DTOAPIRes_UserInfo>(x);
                    userInfo.roles = x.AccountRoles.Select(c => this.mapper.Map<DTOAPI_Role>(c.role) ).ToList();
                    return userInfo;
                }).ToArray()
            };

            return ret_model;
        }