Пример #1
0
        public IActionResult GetTopic(Guid id)
        {
            if (!noterRepository.TopicExists(id))
            {
                return(NotFound());
            }
            var topicEntity = noterRepository.GetTopic(id);
            var topicDto    = Mapper.Map <TopicDto>(topicEntity);

            return(Ok(topicDto));
        }
Пример #2
0
        public IActionResult GetCommentaryForTopic(Guid topicId, Guid id)
        {
            if (!noterRepository.TopicExists(topicId))
            {
                return(NotFound());
            }

            if (!noterRepository.CommentaryExistsForTopic(topicId, id))
            {
                return(NotFound());
            }

            var commentaryEntity = noterRepository.GetCommentaryForTopic(topicId, id);
            var commentaryDto    = Mapper.Map <CommentaryDto>(commentaryEntity);

            return(Ok(commentaryDto));
        }