public async Task <ActionResult> SpeakerDetails(string speakerName) { if (speakerName.Contains("tein")) { return(View("Error")); } var speaker = await ConferenceService.GetSpeakerByName(speakerName); return(View(speaker)); }
public async Task <ActionResult> SpeakerDetails(string speakerName) { if (speakerName.EndsWith("tein")) { var throwingTask = Task.Factory.StartNew(ThrowProhibitedSurnameException); // The exception is rethrown here, but the source is on another thread. throwingTask.Wait(); } var speaker = await _conferenceService.GetSpeakerByName(speakerName); var speakerPhoto = await _conferenceService.GetSpeakerPhoto(speakerName); HttpContext.Cache.Insert(Guid.NewGuid().ToString(), speakerPhoto); return(View(speaker)); }