public void LogIn()
        {
            while (true)
            {
                Console.Clear();

                string email;
                string password;

                Console.Write("Email : ");
                email = Console.ReadLine();

                if (_provider.IsEmailExist(email))
                {
                    Console.Write("Password : "******"Uncorrect password, press any key to try again");
                        Console.ReadKey();
                    }
                }
                else
                {
                    ShowErrorMessage("User with this email not found, press 0 to go to previous page, pressany any other key try again");
                    if (Console.ReadKey().Key == ConsoleKey.D0)
                    {
                        Console.Clear();
                        this.Init();
                        break;
                    }

                    Console.Clear();
                }
            }
        }
Exemplo n.º 2
0
        public void BackToMainMenu()
        {
            MainMenuPage mainMenuPage = new MainMenuPage(_user);

            mainMenuPage.Init();
        }
        public void Registration()
        {
            bool val = true;

            while (val)
            {
                Console.Clear();

                UserDTO user = new UserDTO();
                string  password, confirmPassword;

                Console.Write("Name : ");
                user.Name = Console.ReadLine();

                Console.Write("Email : ");
                user.Email = Console.ReadLine();

                if (_provider.IsEmailExist(user.Email))
                {
                    ShowErrorMessage("User with this email exist in our system, press (0) to try login," +
                                     " \npressany any other key try another email");
                    if (Console.ReadLine() == "0")
                    {
                        Console.Clear();
                        AuthenticationPage authentication = new AuthenticationPage();
                        authentication.Init();
                        break;
                    }

                    Console.Clear();
                }
                else
                {
                    while (true)
                    {
                        Console.Write("Password : "******"Confirm Password : "******"User created successfully!\nPress any key to start work!");
                            Console.ReadLine();
                            Console.Clear();
                            MainMenuPage mainMenuPage = new MainMenuPage(user);
                            mainMenuPage.Init();
                            val = false;
                            break;
                        }
                        else
                        {
                            // todo
                            Console.Clear();
                            ShowErrorMessage("You enter different passwords, try again");
                        }
                    }
                }
            }
        }