Пример #1
0
        public async Task <SpeakerResponse> GetSpeakerById(int speakerId)
        {
            var speaker = await _repository.GetSpeakerById(speakerId);

            if (speaker == null)
            {
                return(null);
            }

            return(new SpeakerResponse(speaker));
        }
Пример #2
0
        private async Task <List <SpeakersUrlResponse> > GetSpeakers(string speakers)
        {
            List <SpeakersUrlResponse> speakersUrlResponses = new List <SpeakersUrlResponse>();

            if (!string.IsNullOrEmpty(speakers))
            {
                var speakersId = speakers.Split(',');

                if (speakersId != null)
                {
                    foreach (var code in speakersId)
                    {
                        var s = await _speakerRepository.GetSpeakerById(int.Parse(code.Trim()));

                        if (s != null)
                        {
                            speakersUrlResponses.Add(new SpeakersUrlResponse(s.Name, int.Parse(code.Trim())));
                        }
                    }
                }
            }

            return(speakersUrlResponses);
        }
        public IActionResult GetSpeakerById(int id)
        {
            SpeakerModel speaker = _speakerRepository.GetSpeakerById(id);

            return(Ok(speaker));
        }
Пример #4
0
 public async Task <Speaker> GetSpeakerById(int speakerId)
 {
     return(await _speakerRepository.GetSpeakerById(speakerId));
 }