public async Task <ActionResult <IEnumerable <Vocabulary> > > GetAllVocabularies() { var vocabularies = await _vocabularyService.GetAllVocabularies(); var vocabulariesDto = _mapper.Map <IEnumerable <Vocabulary>, IEnumerable <VocabularyDto> >(vocabularies); return(Ok(vocabulariesDto)); }
/* * public VocabularyController(IVocabularyService vocabularyService) * { * _vocabularyService = vocabularyService; * } */ public async Task <IEnumerable <Vocabulary> > Get() { try { return(await _vocabularyService.GetAllVocabularies().ConfigureAwait(false)); } catch (Exception ex) { // TODO: log and then mask exception from user // throwing again so that the response code will be 500 throw; } }