Beispiel #1
0
        public async Task <VenueResponse> EditVenueAsync(VenueRequest venue, Guid venueId)
        {
            LocationIqReverseResponse locationResponse = await _locationIqProvider.GetLocationDetailsAsync(venue.Postcode);

            VenueAddress venueAddress = locationResponse.MapAddressProperties(venue.BuildingNameOrNumber);

            VenueDto venueDto = venue.MapRequestToDto(Guid.Empty, venueAddress);

            await _venueRepo.EditVenueAsync(venueDto);

            return(await GetVenueAsync(venueId));
        }
Beispiel #2
0
 public static VenueLocationGeoJson MapToGeoJson(this LocationIqReverseResponse locationIqResponse)
 {
     return(new VenueLocationGeoJson
     {
         Type = GeoJsonType.Point,
         Coordinates = new double[]
         {
             double.Parse(locationIqResponse.Longitude),
             double.Parse(locationIqResponse.Latitude)
         }
     });
 }
        public static VenueAddress MapAddressProperties(this LocationIqReverseResponse locationIqResponse, string buildingNameOrNumber)
        {
            VenueAddress mappedAddress = new VenueAddress
            {
                Postcode             = locationIqResponse.Address.Postcode,
                Road                 = locationIqResponse.Address.Road,
                Town                 = locationIqResponse.Address.Town,
                Suburb               = locationIqResponse.Address.Suburb,
                Village              = locationIqResponse.Address.Village,
                County               = locationIqResponse.Address.County,
                State                = locationIqResponse.Address.State,
                Country              = locationIqResponse.Address.Country,
                BuildingNameOrNumber = buildingNameOrNumber
            };

            mappedAddress.DisplayName = mappedAddress.MapDisplayNameProperties();

            return(mappedAddress);
        }
Beispiel #4
0
        public async Task <VenueResponse> AddVenueAsync(VenueRequest venue)
        {
            LocationIqReverseResponse locationResponse = await _locationIqProvider.GetLocationDetailsAsync(venue.Postcode);

            VenueAddress venueAddress = locationResponse.MapAddressProperties(venue.BuildingNameOrNumber);

            VenueDto venueDto = venue.MapRequestToDto(Guid.Empty, venueAddress);

            Guid insertedVenueId = await _venueRepo.AddVenueAsync(venueDto);

            VenueLocation venueLocation = new VenueLocation
            {
                Location = locationResponse.MapToGeoJson(),
                VenueId  = insertedVenueId
            };

            await _locationIqProvider.AddGeoLocation(venueLocation);

            return(await GetVenueAsync(insertedVenueId));
        }
Beispiel #5
0
        public async Task <LocationIqReverseResponse> GetLocationDetailsAsync(string postcode)
        {
            LocationIqReverseResponse locationIqResponse = await _locationIqProxy.GetLocationDetailsAsync(postcode);

            return(locationIqResponse);
        }