Example #1
0
        public static ContactModel ToModel(Contact contact)
        {
            if (contact == null)
            {
                return(null);
            }

            return(new ContactModel
            {
                Id = contact.Id,
                Name = contact.Name,
                Number = contact.Number,
                NumberPrefix = NumberPrefixProvider.GetById(contact.CountryPrefixId)
            });
        }
Example #2
0
        public static BarrierModel ToModel(Barrier barrier)
        {
            if (barrier == null)
            {
                return(null);
            }

            return(new BarrierModel
            {
                Id = barrier.Id,
                NumberPrefix = NumberPrefixProvider.GetById(barrier.CountryPrefixId),
                Number = barrier.Number,
                MessageText = barrier.MessageText
            });
        }
        public async Task <SettingsModel> GetSettingsAsync()
        {
            var settingsModel = new SettingsModel();

            var defaultNumberPrefixSetting = await _settingRepository.GetByKeyAsync(DataConstants.SettingDefaultNumberPrefixKey);

            if (defaultNumberPrefixSetting == null)
            {
                settingsModel.NumberPrefix = NumberPrefixProvider.GetNumberPrefixes().FirstOrDefault();
            }
            else
            {
                settingsModel.NumberPrefix = NumberPrefixProvider.GetById(int.Parse(defaultNumberPrefixSetting.Value));
            }

            return(settingsModel);
        }