private void CheckUsername(string username) { if (Identities.Any(x => String.Equals(x.Username, username, StringComparison.InvariantCultureIgnoreCase))) { throw new DuplicateUsernameException("The username '" + username + "' is already in use."); } }
/// <summary> /// Returns true if an Identity exists with the username. /// </summary> public bool UsernameIsTaken(string username) { var value = username.ToUpperInvariant(); return(Identities.Any(x => x.Username == value)); }