Esempio n. 1
0
        private async Task UpdateLocalContactDB(string id, NexmoInfo nexmoInfo)
        {
            var local = await db.conn.Table<LocalContactDB>().Where(x => x.Id == id).FirstOrDefaultAsync();

            if (local != null)
            {
                local.Carrier = nexmoInfo.NexmoLookup.Carrier;
                local.Country = nexmoInfo.NexmoFormat.Country;
                local.InternationalNumber = nexmoInfo.NexmoFormat.InternationalNumber;
                local.Network = nexmoInfo.NexmoLookup.Network;
                local.Prefix = nexmoInfo.NexmoFormat.Prefix;
            }
        }
Esempio n. 2
0
        private async Task<NexmoInfo> GetNexmoInfo(string phone, string country, int type, string id)
        {
            NexmoFormat format = (NexmoFormat)GetNexmoFormatLookup(phone, country, "format");

            if (format == null)
                return null;

            NexmoLookup lookup = (type == 1 || type == 2)
                ? (NexmoLookup)GetNexmoFormatLookup(phone, country, "lookup")
                : new NexmoLookup() { Network = "", Carrier = "" };

            if (lookup == null)
                return null;

            NexmoInfo nexmoInfo = new NexmoInfo() { NexmoFormat = format, NexmoLookup = lookup };
            await UpdateLocalContactDB(id, nexmoInfo);
            return nexmoInfo;
        }