public User Register(User user)
 {
     if (ValidationHelpers.UsernameValidation(user.Username) == null ||
         ValidationHelpers.PasswordValidation(user.Password) == null ||
         ValidationHelpers.NameValidation(user.FirstName) == null ||
         ValidationHelpers.NameValidation(user.LastName) == null ||
         ValidationHelpers.AgeValidation(user.Age) == -1)
     {
         return(null);
     }
     return(user);
 }
Ejemplo n.º 2
0
        public T Register(T user)
        {
            if (!ValidationHelpers.ValidateFirstNameAndLastName(user.FirstName, user.LastName) ||
                ValidationHelpers.AgeValidation(user.Age) == -1 ||
                ValidationHelpers.ValidateUserName(user.Username) == null ||
                ValidationHelpers.ValidatePassword(user.Password) == null)
            {
                MessageHelpers.Message("You have entered something wrong!", ConsoleColor.Red);
                Console.ReadLine();
                return(null);
            }
            int id = _dB.Insert(user);

            return(_dB.GetUserById(id));
        }