Ejemplo n.º 1
0
        public IActionResult UpdatePointOfInterest(int poiId, [FromBody] PointOfInterestDto poiDto)
        {
            if (poiDto == null || poiDto.Id != poiId)
            {
                return(BadRequest());
            }

            var poi = _dtoMapper.PoiDtoToPoi(poiDto);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (!ValidatePoiExists(poi))
            {
                return(NotFound());
            }

            _repository.UpdatePointOfInterest(poi);
            return(new NoContentResult());
        }