示例#1
0
        static void Movie()
        {
            int x = 1;

            while (x > 0)
            {
                Console.WriteLine("1. Get all Movie");
                Console.WriteLine("2. Add Reviewer");
                Console.WriteLine("3. Update Reviewer");
                Console.WriteLine("4. Delete Reviewer");
                Console.WriteLine("5. Back");

                x = Convert.ToInt32(Console.ReadLine());

                Console.Clear();

                switch (x)
                {
                case 1:
                    MovieCRUD.PrintAll();
                    Console.ReadKey();
                    break;

                case 2:
                    MovieCRUD.Add();
                    break;

                case 3:
                    MovieCRUD.Update();
                    break;

                case 4:
                    MovieCRUD.Delete();
                    break;

                case 5:
                    x = -1;
                    break;
                }

                Console.Clear();
            }
        }
示例#2
0
        public static void Add()
        {
            IRatingContex contex = new RatingContex();

            Rating rating = new Rating();

            Console.WriteLine("REVIEWERS");
            ReviewerCRUD.PrintAll();

            Console.WriteLine("MOVIES");
            MovieCRUD.PrintAll();

            Console.Write("/nEnter Reviewer ID: ");
            rating.rID = Convert.ToInt32(Console.ReadLine());
            Console.Write("/nEnter Movie ID: ");
            rating.mID = Convert.ToInt32(Console.ReadLine());
            Console.Write("/nEnter Stars: ");
            rating.Stars = Convert.ToInt32(Console.ReadLine());
            Console.Write("/nEnter Date: ");
            rating.RatingDate = Convert.ToDateTime(Console.ReadLine());

            contex.Add(rating);
        }