Ejemplo n.º 1
0
        public async Task<List<Language>> GetLanguagesAsync(int id)
        {
            var speeches = await GetChildrenByIdAsync(id);

            var speech = speeches.First();

            var audios = await _speechService.GetChildrenByIdAsync(speech.Id);

            var languagesIds = audios.Select(audio => audio.LanguageId).ToList();

            var listOfLanguages = new List<Language>();

            foreach (var langId in languagesIds)
            {
                listOfLanguages.Add(await _languageService.GetByIdAsync(langId));
            }

            return listOfLanguages;
        }
        public async Task <List <AudioDTO> > GetAudiosBySpeechIdAsync(int id)
        {
            var listOfAudios = await _speechService.GetChildrenByIdAsync(id);

            return(_mapper.Map <List <Audio>, List <AudioDTO> >(listOfAudios));
        }