public IActionResult GetDogs(int clientId) { try { if (!_clientInfoRepository.ClientExists(clientId)) { return(NotFound()); } var dogsOfClient = _clientInfoRepository.GetDogsForClient(clientId); return(Ok(_mapper.Map <IEnumerable <DogDto> >(dogsOfClient))); } catch (Exception e) { return(StatusCode(500, "A problem occured when handling the request")); } }