private void FilterMobilePrefixes(string key) { if (string.IsNullOrEmpty(key)) { FilteredMobilePrefixes = MobilePrefixes; } else { FilteredMobilePrefixes = new ObservableCollection <MobilePrefix>(MobilePrefixes.Where(p => p.Prefix.Contains(key))); } }
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); }