Пример #1
0
        public void LoginAsUser()
        {
            StartService startService = new StartService(ref Repo);


            User userLoggingIn;

            // TODO: Implement Login functionality for existing users

            Console.WriteLine("Please put in your email, then your password to login.");


            userLoggingIn = startService.GetUserByEmail(UserRequestUtility.QueryEmail());

            if (userLoggingIn is null)
            {
                Console.WriteLine("Couldn't find a user matching that email. You can try again if you want, that'll be fun.");
                LoginMenu loginMenuButAgain = new LoginMenu(ref Repo);
                MenuManager.Instance.ReadyNextMenu(loginMenuButAgain);
            }
            else if (userLoggingIn is Customer || userLoggingIn is Manager)
            {
                string userInputPassword = UserRequestUtility.QueryPassword();
                while (userInputPassword != userLoggingIn.Password)
                {
                    userInputPassword = UserRequestUtility.QueryPassword();
                }
            }



            // TODO: When SignUp() ends, add the new customer data to DB/file
            switch (selectedChoice)
            {
            case 1:
                //TODO: Update a database with an added customer using BL.

                break;

            case 2:
                //TODO: Update a database with an added manager using BL.

                break;

            default:
                throw new NotImplementedException();
                //break;
            }

            //TODO: Check at Login() if the inputted email and password match any existing customer or Manager, then make the current user either customer or manager.

            // TODO: Move to next menu.
        }