コード例 #1
0
        private bool IsValidPhoneNumbers(UserModel userModel)
        {
            // validate user phone numbers
            var isValidPhoneNumbers = true;

            foreach (var phone in userModel.Phones)
            {
                string formatedPhoneNumber;
                if (_phoneRepository.IsValidPhoneNumber(phone.PhoneNumber, out formatedPhoneNumber))
                {
                    phone.PhoneNumber = formatedPhoneNumber;
                }
                else
                {
                    isValidPhoneNumbers = false;
                    break;
                }
            }

            return(isValidPhoneNumbers);
        }
コード例 #2
0
 /// <summary>
 /// check if given phone number is valid format e.g E.164
 /// </summary>
 /// <param name="phoneNumber"></param>
 /// <param name="formatedPhoneNumber"></param>
 /// <returns></returns>
 public bool IsValidPhoneNumber(string phoneNumber, out string formatedPhoneNumber)
 {
     return(_phoneRepository.IsValidPhoneNumber(phoneNumber, out formatedPhoneNumber));
 }