示例#1
0
 private void FilterMobilePrefixes(string key)
 {
     if (string.IsNullOrEmpty(key))
     {
         FilteredMobilePrefixes = MobilePrefixes;
     }
     else
     {
         FilteredMobilePrefixes = new ObservableCollection <MobilePrefix>(MobilePrefixes.Where(p => p.Prefix.Contains(key)));
     }
 }
示例#2
0
        private bool ValidateMobile(User user)
        {
            MobilePrefixes mobilePrefix = (MobilePrefixes)Enum.Parse(typeof(MobilePrefixes), user.Resident);
            int            value        = (int)mobilePrefix;

            if (!user.Mobile.StartsWith(value.ToString()))
            {
                throw new BadRequestException(message: "Mobile prefix should match users country mobile prefix!");
            }

            return(true);
        }