public ActionResult <IEnumerable <TalkDto> > GetTalksForSpeaker(int speakerId) { if (!_speakerRepository.SpeakerExists(speakerId)) { return(NotFound()); } var talksForSpeaker = _talkRepository.GetTalks(speakerId).ToList(); return(Ok(_mapper.Map <IEnumerable <TalkDto> >(talksForSpeaker))); }
public ActionResult <List <TalkEntity> > GetTalks(int conventionId) { try { var talks = talkRepository.GetTalks(conventionId).Result; return(talks); } catch (KeyNotFoundException) { return(NotFound()); } }
public async Task <List <TalkResponse> > GetTalks() { var talks = await _talkRepository.GetTalks(); List <TalkResponse> talksReponse = new List <TalkResponse>(); if (talks == null || !talks.Any()) { return(talksReponse); } foreach (var item in talks) { var tr = new TalkResponse(item); tr.Speakers = await GetSpeakers(item.Speakers); talksReponse.Add(tr); } ; return(talksReponse); }