Ejemplo n.º 1
0
        public bool UpdateShow()
        {
            Show S2 = new Show();

            Console.WriteLine("Enter Theatre Name: ");
            S2.TName = Console.ReadLine();
            Console.WriteLine("Enter Movie Name: ");
            S2.MName = Console.ReadLine();
            if (S2.MName != "" && S2.TName != "")
            {
                foreach (Movie m in Movies)
                {
                    if (m.ThName == S2.TName && m.MovieName == S2.MName)
                    {
                        Console.WriteLine("Enter the Show Timing to be Updated: ");
                        S2.ShowName = Console.ReadLine();
                        foreach (Show s in Shows)
                        {
                            if (s.ShowName == S2.ShowName)
                            {
                                Console.WriteLine("Enter the New Show Timing: ");
                                S2.ShowName = Console.ReadLine();
                                int i = Shows.IndexOf(s);
                                Shows.RemoveAt(i);
                                Shows.Insert(i, S2);
                                Console.WriteLine("Show Timing: " + S2.ShowName + " updated for " + S2.MName + " at " + S2.TName + " Theatre.");
                                return(true);
                            }
                        }
                        Console.WriteLine("Show Timing is incorrect.");
                        return(false);
                    }
                }
                Console.WriteLine("Movie or Theatre name incorrect.");
                return(false);
            }
            else
            {
                Console.WriteLine("Movie or Theatre name cannot be null.");
                return(false);
            }
        }