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;
            }
        }
Пример #2
0
        public void RentMovie(User user, List <Movie> allrented, List <Movie> all)
        {
            Console.Clear();
            moviesServices.SeeAvaliableMovies(all, allrented);
            int result = Validation.CheckIfNum("Which movie you want to rent?");

            if (result != 0 && result <= all.Count && allrented.IndexOf(all[result - 1]) == -1)
            {
                allrented.Add(all[result - 1]);
                user.Movies.Add(all[result - 1]);
                Console.WriteLine($"You rented {all[result-1].Title}!");
            }
            else
            {
                Console.WriteLine($"Movie is either not available or not on the list!");
            }
        }