Exemplo n.º 1
0
        //metode za unos i brisanje
        public static void UnesiLiniju()
        {
            IspisiSveLetove();

            Airline airline = new Airline();

            airline.Id = 0;
            Console.WriteLine("Enter the airline name: ");
            string aName = Console.ReadLine();

            airline.Name = aName;

            AirplaneUI.IspisiSveAvione();
            Console.WriteLine("Choose airplane id you want to fly:");
            string aId = Console.ReadLine();
            int    idAviona;
            bool   provera = IOPomocnaKlasa.ProveraDaLiJeBr(aId);

            if (provera == true)
            {
                idAviona         = int.Parse(aId);
                airline.Airplane = AirplaneDAO.GetAvionById(idAviona);
            }
            AirportUI.IspisiSveAerodrome();
            Console.WriteLine("Choose id of departure airport:");
            string aId1 = Console.ReadLine();
            int    idAerodromaPoletanje;
            bool   provera1 = IOPomocnaKlasa.ProveraDaLiJeBr(aId1);

            if (provera1 == true)
            {
                idAerodromaPoletanje     = int.Parse(aId1);
                airline.AirportDeparture = AirportDAO.GetAerodromById(idAerodromaPoletanje);
            }
            AirportUI.IspisiSveAerodrome();
            Console.WriteLine("Choose id of destination airport:");
            string aId2 = Console.ReadLine();
            int    idAerodromaSletanje;
            bool   provera2 = IOPomocnaKlasa.ProveraDaLiJeBr(aId2);

            if (provera2 == true)
            {
                idAerodromaSletanje        = int.Parse(aId2);
                airline.AirportDestination = AirportDAO.GetAerodromById(idAerodromaSletanje);
            }
            if (airline.AirportDeparture.Equals(airline.AirportDestination))
            {
                Console.WriteLine("You cannot take off and land at the same airport!");
            }
            else
            {
                AirlineDAO.Add(airline);
            }
        }
Exemplo n.º 2
0
        //METODE ZA PRETRAGU AVIONA
        public static Airport PronadjiAerodromPoId(int id)
        {
            Airport retVal = AirportDAO.GetAerodromById(id);

            return(retVal);
        }