Exemplo n.º 1
0
        public ActionResult AddLocation(CreateLocationRequest createLocationRequest)
        {
            var newLocation = _locationRepository.AddNewLocation(
                createLocationRequest.UserId,
                createLocationRequest.ItineraryId,
                createLocationRequest.LocationName,
                createLocationRequest.Address,
                createLocationRequest.Rating,
                createLocationRequest.Price,
                createLocationRequest.Photo_ref,
                createLocationRequest.Html_attr);

            // Adds new locationInterestType
            _locationRepository.AddNewLocationInterestType(
                createLocationRequest.InterestTypeId,
                newLocation.Id);

            // Adds new itineraryLocation
            _locationRepository.AddNewItineraryLocation(
                createLocationRequest.LocationId,
                createLocationRequest.ItineraryId);

            return(Created($"/api/locations/{newLocation.Id}", newLocation));
        }