public async Task <ActionResult <IEnumerable <CoachResponse> > > GetAllCoaches() { try { var coaches = await _repository.GetAllCoaches(); var coachesResponse = coaches.Select(c => _mapper.Map <CoachResponse>(c)); _logger.LogInformation($"Coaches have been downloaded."); return(Ok(coachesResponse)); } catch (System.Exception ext) { _logger.LogError(ext, "Failed to download coaches list."); // TODO return error object with proper error code. return(BadRequest()); } }
public List <Coach> GetAllCoaches(string[] include = null) { return(_coachRepository.GetAllCoaches(include)); }
// // GET: /Coach/ public ViewResult Index() { return(View(coachRepository.GetAllCoaches(coach => coach.Activities))); }