Пример #1
0
        /// <summary>
        /// Service method to activate existing phone number
        /// </summary>
        /// <param name="phoneId"></param>
        public void ActivatePhoneNumber(string phoneId)
        {
            if (string.IsNullOrWhiteSpace(phoneId))
            {
                throw new ArgumentException("PhoneId not passed in request");
            }

            int phoneNumberId = 0;

            if (Int32.TryParse(phoneId, out phoneNumberId))
            {
                PhoneNumber numbers = phoneNumbers.FirstOrDefault(pn => pn.Identity == phoneNumberId);
                if (numbers != null)
                {
                    numbers.ActivatePhoneNumber(true);
                }
                else
                {
                    throw new Exception($"Provided phone number {phoneId} does not exist on the system. Activation Failed");
                }
            }
        }