/// <summary>
 /// Create a new Country object.
 /// </summary>
 /// <param name="countryID">Initial value of the CountryID property.</param>
 /// <param name="countryName">Initial value of the CountryName property.</param>
 public static Country CreateCountry(global::System.Int32 countryID, global::System.String countryName)
 {
     Country country = new Country();
     country.CountryID = countryID;
     country.CountryName = countryName;
     return country;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Countries EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCountries(Country country)
 {
     base.AddObject("Countries", country);
 }
        private Int32 AddCountry(string countryName)
        {
            var countries = entities.Countries;
            foreach (var i in countries)
            {
                if(String.Equals(i.CountryName.ToLower(),countryName.Trim().ToLower()))
                {
                    return i.CountryID;
                }
            }
            Country newCountry = new Country();
            newCountry.CountryName = countryName.Trim();

            entities.Countries.AddObject(newCountry);
            entities.SaveChanges();
            return newCountry.CountryID;
        }