Beispiel #1
0
 /// <summary>
 /// 获取栏目集合
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public GetNodesOutput GetNodes(GetNodesInput input)
 {
     GetNodesOutput output = new GetNodesOutput();
     int limit = input.Limit.HasValue ? input.Limit.Value : CMSConsts.PageLimit;
     int offset = input.Offset.HasValue ? input.Offset.Value : 0;
     var nodes = Mapper.DynamicMap<IList<NodeDto>>(_nodeRepository.GetNodesPagingByPublishmentSystemId(input.PublishmentSystemId, limit, offset));
     output.Items = nodes;
     output.TotalCount = _nodeRepository.Count(node => node.PublishmentSystemId == input.PublishmentSystemId);
     return output;
 }
Beispiel #2
0
 /// <summary>
 /// 根据parentId获取栏目集合
 /// </summary>
 /// <param name="?"></param>
 /// <returns></returns>
 public async Task<GetNodesOutput> GetNodesByParentId(GetNodesInput input)
 {
     GetNodesOutput output = new GetNodesOutput();
     //根据parentId查询
     if (input.ParentId.HasValue)
     {
         var nodes = Mapper.DynamicMap<IList<NodeDto>>(await _nodeRepository.FindByParentIdAsync(input.ParentId.Value));
         output.Items = nodes;
     }
     return output;
 }
Beispiel #3
0
 /// <summary>
 /// 根据id获取栏目
 /// </summary>
 /// <param name="?"></param>
 /// <returns></returns>
 public async Task<GetNodesOutput> GetNodeById(GetNodesInput input)
 {
     GetNodesOutput output = new GetNodesOutput();
     //根据ID查询
     if (input.NodeId.HasValue)
     {
         var node = Mapper.DynamicMap<NodeDto>(await _nodeRepository.FirstOrDefaultAsync(input.NodeId.Value));
         output.Items.Add(node);
         output.Node = node;
     }
     return output;
 }
Beispiel #4
0
 /// <summary>
 /// 根据publishmentSystemId, nodeIndex获取栏目集合
 /// </summary>
 /// <param name="?"></param>
 /// <returns></returns>
 public async Task<GetNodesOutput> GetNodeByNodeIndex(GetNodesInput input)
 {
     GetNodesOutput output = new GetNodesOutput();
     //根据publishmentSystemId, nodeIndex查询
     if (!string.IsNullOrEmpty(input.NodeIndex))
     {
         var node = Mapper.DynamicMap<NodeDto>(await _nodeRepository.FindByIndexAsync(input.PublishmentSystemId,
             input.NodeIndex));
         output.Items.Add(node);
         output.Node = node;
     }
     return output;
 }
Beispiel #5
0
 /// <summary>
 /// 根据publishmentSystemId, nodeName获取栏目集合
 /// </summary>
 /// <param name="?"></param>
 /// <returns></returns>
 public async Task<GetNodesOutput> GetNodesByNodeIndex(GetNodesInput input)
 {
     GetNodesOutput output = new GetNodesOutput();
     //根据publishmentSystemId, nodeName查询
     if (!string.IsNullOrEmpty(input.NodeName))
     {
         var nodes = Mapper.DynamicMap<IList<NodeDto>>(await _nodeRepository.FindByNameAsync(input.PublishmentSystemId,
             input.NodeName));
         output.Items = nodes;
     }
     return output;
 }