コード例 #1
0
        public void UserFlow(UserServices users, MovieServices movies, User user)
        {
            Console.Clear();
            Console.WriteLine("Choose an action: 1)See subscription info  2)Select a movie to rent  3)See your rented movies  4)Return movie");
            string result = Console.ReadLine();

            switch (result)
            {
            case "1":
                users.SeeInfo(user);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res = Console.ReadLine();
                if (res == "1")
                {
                    UserFlow(users, movies, user);
                }
                break;

            case "2":
                users.RentMovie(user, movies.RentedMovies, movies.AllMovies);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res1 = Console.ReadLine();
                if (res1 == "1")
                {
                    UserFlow(users, movies, user);
                }
                break;

            case "3":
                users.SeeRented(user);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res2 = Console.ReadLine();
                if (res2 == "1")
                {
                    UserFlow(users, movies, user);
                }
                break;

            case "4":
                users.ReturnMovie(user, movies.RentedMovies);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res3 = Console.ReadLine();
                if (res3 == "1")
                {
                    UserFlow(users, movies, user);
                }
                break;

            default:
                Console.WriteLine("No such action. Insert 1 to try again. Insert any other key to go back");
                string res4 = Console.ReadLine();
                if (res4 == "1")
                {
                    UserFlow(users, movies, user);
                }
                break;
            }
        }
コード例 #2
0
        public void EmployeeFlow(EmployeeServices employees, MovieServices movies)
        {
            Console.Clear();
            Console.WriteLine("Choose an action: 1)See registered users  2)See avaliable movies  3)Register a member  4)Delete a member");
            string result = Console.ReadLine();

            switch (result)
            {
            case "1":
                employees.SeeMembers(employees.RegisteredMembers);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res = Console.ReadLine();
                if (res == "1")
                {
                    EmployeeFlow(employees, movies);
                }
                break;

            case "2":
                movies.SeeAvaliableMovies(movies.AllMovies, movies.RentedMovies);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res1 = Console.ReadLine();
                if (res1 == "1")
                {
                    EmployeeFlow(employees, movies);
                }
                break;

            case "3":
                employees.AddMember(employees.RegisteredMembers);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res2 = Console.ReadLine();
                if (res2 == "1")
                {
                    EmployeeFlow(employees, movies);
                }
                break;

            case "4":
                employees.DeleteMember(employees.RegisteredMembers, movies.RentedMovies);
                Console.WriteLine("Insert 1 to perform another action. Insert any other key to go back");
                string res3 = Console.ReadLine();
                if (res3 == "1")
                {
                    EmployeeFlow(employees, movies);
                }
                break;

            default:
                Console.WriteLine("No such action. Insert 1 to try again. Insert any other key to go back");
                string res4 = Console.ReadLine();
                if (res4 == "1")
                {
                    EmployeeFlow(employees, movies);
                }
                break;
            }
        }