Exemple #1
0
        public PointOfInterestViewModel Get(Guid id)
        {
            var pointOfInterest = _PointOfInterestService.Get(id);

            if (pointOfInterest == null)
            {
                throw new NotFoundException("Não foi encontrado nenhum ponto de interesse com o identificador fornecido.");
            }

            return(_Mapper.Map <PointOfInterest, PointOfInterestViewModel>(pointOfInterest));
        }
        public async Task <IActionResult> GetAsync(int cityId, int id)
        {
            try
            {
                if (!_cityService.CityExists(cityId).Result)
                {
                    return(NotFound());
                }

                var pointsOfInterest = await _pointOfInterestService.Get(cityId, id);

                if (pointsOfInterest != null)
                {
                    return(Ok(pointsOfInterest));
                }

                return(NotFound());
            }
            catch (Exception exception)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, exception.Message));
            }
        }