Exemplo n.º 1
0
        public static string NullOrNotEmail([ValidatedNotNull] string?email, string paramName)
        {
            if (!ValidationMethods.IsEmail(email))
            {
                throw new ArgumentException(HB.Framework.Common.Properties.Resources.NotEmailErrorMessage, paramName);
            }

            return(email);
        }
Exemplo n.º 2
0
        public static string?NotEmail(string?email, string paramName, bool canBeNull)
        {
            if (email == null)
            {
                if (canBeNull)
                {
                    return(null);
                }
                else
                {
                    throw new ArgumentNullException($"Parameter:{ paramName}");
                }
            }

            if (!ValidationMethods.IsEmail(email))
            {
                throw new ArgumentException($"Parameter:{ paramName}");
            }

            return(email);
        }