Exemplo n.º 1
0
        public IActionResult GetAll(int level = 0)
        {
            var topics = _topicService.FindByNoTracking(x => x.Level == level && x.DateDeleted == null);
            var dto    = _mapper.Map <List <TopicDto> >(topics.ToList());

            return(Ok(dto));
        }
Exemplo n.º 2
0
        public IActionResult ThreadsPerTopic()
        {
            var topics = _topicService.FindByNoTracking(x => x.Level == 0, "SubTopics");

            return(Ok(topics.Select(x => new
            {
                Key = x.Name,
                Value = x.SubTopics.Sum(s => s.NumberOfThreads)
            }).OrderBy(x => x.Value).TakeLast(7)));
        }