Beispiel #1
0
        public bool AddOrUpdateCity(int cityID, City city)
        {
            City _City = CityRepository.GetById(cityID);

            if (_City == null)
            {
                Logger.LogInfo($"  *Inserting city with cityID: {cityID} and city name {city.CityName}");

                CityRepository.AddWithIDOn(city, "iSele.Cities");
                //await CityRepository.AddWithIDOnAsync(new City
                //{
                //    CityID = cityID,
                //    CityName = city.CityName,
                //    AreaID = city.CityID,
                //    CountryCode = "ZAF",
                //    Notes = String.Format("Update {0:d}", DateTime.UtcNow.Date)
                //},
                //    "iSele.Cities");
                return(true);
            }
            else
            {
                Logger.LogInfo($"  *Updating city with cityID: {cityID} and city name {city.CityName}");
                CityRepository.UpdateAsync(city);
                return(false);
            }
        }