Exemple #1
0
        public IQueryable <TelephoneCountryCode> FindTelephoneCountryCodes(string matching)
        {
            string m = matching.Trim().ToUpper();

            //This pattern is necessary as you can't join to a queryable of type Interface
            var isoCodesForMatchingCountries = CountryService.FindCountryByName(matching).Select(x => x.ISOCode).ToList();

            IList <String> allCodes = CountryService.AllCountries().Select(x => x.ISOCode).ToList();;
            var            codes    = Container.Instances <TelephoneCountryCode>();

            var q = from code in codes
                    where code.CountryCallingCode.Contains(m) ||
                    code.ISOCountryCode.ToUpper().Contains(m) ||
                    (isoCodesForMatchingCountries.Contains(code.ISOCountryCode))
                    select code;

            return(q.Distinct().OrderBy(X => X.ISOCountryCode));
        }
 public IList <ICountry> ChoicesCountry()
 {
     return(CountryService.AllCountries().ToList());
 }