コード例 #1
0
 public void PutGeoLocation(GeoLocation geoLocation)                         //  update coordinates with name that are given
 {
     if (!repository.Update(geoLocation))
     {
         throw new ArgumentNullException("Opps ! There is no geolocation with name #" + geoLocation.Name + " !");
     }
 }
コード例 #2
0
        private GeoLocation saveGeoLocation(Endereco endereco, double latitude, double longitude)
        {
            GeoLocation geoLocation = null;

            if (endereco.GeoLocationId.HasValue)
            {
                geoLocation = _geoLocationRepository.GetById(endereco.GeoLocationId.Value);
            }

            if (geoLocation == null)
            {
                geoLocation = new GeoLocation(latitude, longitude);
                _geoLocationRepository.Add(geoLocation);
            }
            else
            {
                _geoLocationRepository.Update(geoLocation);
            }

            _geoLocationRepository.SaveChanges();

            return(geoLocation);
        }