Ejemplo n.º 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;

    }
Ejemplo n.º 2
0
 public TopicController(TopicQueryService topicQueryService,
                        TopicCommandService topicCommandService)
 {
     this._topicQueryService   = topicQueryService;
     this._topicCommandService = topicCommandService;
 }
Ejemplo n.º 3
0
 public HomeController(TopicQueryService topicQueryService,
                       IMapper mapper)
 {
     this._topicQueryService = topicQueryService;
     _mapper = mapper;
 }