Esempio n. 1
0
        private bool AddAUser()
        {
            Console.WriteLine("Create a new account");
            Console.WriteLine("Enter your full name: ");
            string name = Console.ReadLine();

            Console.WriteLine("Enter your username: "******"Enter a password for this account: ");
            string password = Console.ReadLine();

            bool repeat = true;

            do
            {
                Console.WriteLine("Please re-enter your password: "******"password does not match");
                }
            } while(repeat);

            try
            {
                Customer newUser     = new Customer(name, username, password);
                Customer createdUser = _shopBL.AddUser(newUser);
                Console.WriteLine("New account created! Logging in... \n");
                Console.WriteLine(createdUser.ToString());
                _user = createdUser;
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(false);
        }