コード例 #1
0
        /// <summary>
        /// 资源列表
        /// </summary>
        /// <returns></returns>
        public async Task <List <ResourceItemOutput> > GetResourceList(long parentId)
        {
            var query = new ModuleQuery {
                ParentId = parentId
            };

            query.OrderBy(a => a.Sort).OrderBy(a => a.CreateTime);

            var resources = await _moduleRep.GetListAsync(query);

            var result = resources.Adapt <List <ResourceItemOutput> >();

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 获取模块详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <ModuleDetailOutput> Get(long id)
        {
            var module = await _moduleDomainService.Get(id);

            var result = module.Adapt <ModuleDetailOutput>();

            if (result.Type == ModuleType.Sub)
            {
                var query = new ModuleQuery {
                    ParentId = id
                };

                query.OrderBy(a => a.Sort).OrderBy(a => a.CreateTime);

                var resources = await _moduleRep.GetListAsync(query);

                result.Resources = resources.Adapt <List <ResourceItemOutput> >();
            }

            return(result);
        }