public async Task <ActionResult <SpeakerModel[]> > Get() { try { var results = await _repository.GetAllSpeakersAsync(); return(_mapper.Map <SpeakerModel[]>(results)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure")); } }
public async Task <ActionResult <SpeakerModel[]> > GetAllSpeakersAsync() { try { var ListCapms = await campRepository.GetAllSpeakersAsync(); SpeakerModel[] campModels = mapper.Map <SpeakerModel[]>(ListCapms); return(campModels); } catch (Exception) { return(this.StatusCode(500, "Database Failure")); } }
public async Task <IActionResult> GetAllSpeakers() { try { var SpeakersList = await _campRepository.GetAllSpeakersAsync(); if (!SpeakersList.Any()) { return(NotFound()); } return(Ok(SpeakersList)); } catch { return(this.StatusCode(500, "Database Shutdown")); } }