Skip to content

Instantly share code, notes, and snippets.

Created March 12, 2017 13:02
What would you like to do?
private bool AddNewCity(string cityName, string countryIso)
var city = CountriesCitiesDbService.GetNewCity();
var europeanCountries = CountriesCitiesDbService.GetAllEuropeanCountries();
var country = europeanCountries.FirstOrDefault(ec => ec.IsoCode.Equals(countryIso));
if (country == null)
throw new ArgumentException($"Country with ISO Code {countryIso} does not exist!");
city.Name = cityName;
city.Country = country;
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment