Exemplo n.º 1
0
        public async Task <IActionResult> GetTopics(string?language = null)
        {
            var topics = await topicStore.QueryAsync(App.Id, new TopicQuery { Scope = TopicQueryScope.Explicit }, HttpContext.RequestAborted);

            var response = topics.Select(x => UserTopicDto.FromDomainObject(x, language, App.Language));

            return(Ok(response));
        }
Exemplo n.º 2
0
        public async Task <UserTopicDto> GetUserTopic(string userId, int id)
        {
            var topic = await _context.Topics.FindAsync(id);

            if (topic == null || !topic.UserId.Equals(userId) || topic.IsDeleted)
            {
                throw new KeyNotFoundException("Topic not found");
            }

            return(UserTopicDto.Create(topic));
        }