예제 #1
0
    /*==========================================================================================================================
    | METHOD: GET TOPICS
    >---------------------------------------------------------------------------------------------------------------------------
    | Retrieves a collection of topics with optional control call filter properties Scope, AttributeName and AttributeValue.
    \-------------------------------------------------------------------------------------------------------------------------*/
    /// <summary>
    ///   Retrieves a list of <see cref="QueryResultTopicViewModel"/>s that represent topics under the <paramref name="topic"/>
    ///   which have an <see cref="AttributeRecord"/> with <paramref name="attributeKey"/> and <paramref name="attributeValue"
    ///   />.
    /// </summary>
    /// <param name="topic"></param>
    /// <param name="attributeKey"></param>
    /// <param name="attributeValue"></param>
    /// <returns></returns>
    private static Collection<QueryResultTopicViewModel> GetTopics(
      Topic?  topic             = null,
      string? attributeKey      = null,
      string? attributeValue    = null
    ) {

      /*------------------------------------------------------------------------------------------------------------------------
      | Swallow missing topic
      \-----------------------------------------------------------------------------------------------------------------------*/
      if (topic is null) {
        return new();
      }

      /*------------------------------------------------------------------------------------------------------------------------
      | Establish query options
      \-----------------------------------------------------------------------------------------------------------------------*/
      var options               = new TopicQueryOptions() {
        AttributeName           = attributeKey,
        AttributeValue          = attributeValue,
        FlattenStructure        = false,
        IsRecursive             = false,
        ResultLimit             = 250,
        ShowRoot                = false
      };

      /*------------------------------------------------------------------------------------------------------------------------
      | Get query results
      \-----------------------------------------------------------------------------------------------------------------------*/
      var topicQueryService     = new TopicQueryService();
      var topicQueryResults     = topicQueryService.Query(topic, options);

      /*------------------------------------------------------------------------------------------------------------------------
      | Return Topics list
      \-----------------------------------------------------------------------------------------------------------------------*/
      return topicQueryResults;

    }
예제 #2
0
 public TopicController(TopicQueryService topicQueryService,
                        TopicCommandService topicCommandService)
 {
     this._topicQueryService   = topicQueryService;
     this._topicCommandService = topicCommandService;
 }
 public HomeController(TopicQueryService topicQueryService,
                       IMapper mapper)
 {
     this._topicQueryService = topicQueryService;
     _mapper = mapper;
 }