Beispiel #1
0
        public static DialCode GetDialCodeByCountry(string country)
        {
            var             jsonfile  = DialCodesReader.LoadJson();
            List <DialCode> dialCodes = JsonConvert.DeserializeObject <List <DialCode> >(jsonfile);
            var             dialCode  = dialCodes
                                        .Where(x => x.Country == country)
                                        .FirstOrDefault();

            return(dialCode);
        }
Beispiel #2
0
        public static string GetAreaCodeByCountry(string country)
        {
            var             code      = "";
            var             jsonfile  = DialCodesReader.LoadJson();
            List <DialCode> dialCodes = JsonConvert.DeserializeObject <List <DialCode> >(jsonfile);

            code = dialCodes
                   .Where(x => x.Country == country)
                   .Select(x => x.Prefix)
                   .FirstOrDefault();

            return(code);
        }