예제 #1
0
        public IHttpActionResult Get(string speakername)
        {
            var speakers = _dataService.SpeakerRepository.GetAll().Where(s => s.Name.Contains(speakername)).ToList();
            var count    = speakers.Count();

            if (count > 1)
            {
                return(SpeakersLinkHelper.CreateResponse(speakers, Request));
            }
            else if (count == 1)
            {
                var speaker = speakers.First();
                return(new RedirectResult(SpeakerLinkHelper.CreateLink(Request, speaker).Target, Request));
            }
            else
            {
                return(new NotFoundResult("Speaker not found " + speakername));
            }
        }
        public IHttpActionResult GetSpeaker(int id)
        {
            var speakerInfo = _dataService.SpeakerRepository.Get(id);

            return(SpeakerLinkHelper.CreateResponse(speakerInfo, Request));
        }