/** * Verwijder vlucht van de lijst van vluchten * @Param {Vlucht } teVerwijderenVlucht - De vlucht die we uit de lijst willen halen * @Return {bool} */ public static bool VerwijderVluchtVanLijst(Vlucht teVerwijderenVlucht) { if (teVerwijderenVlucht != null) { return(vluchtLijst.Remove(teVerwijderenVlucht.VluchtNummer)); } return(false); }
/** * Voeg vlucht toe aan de lijst van vluchten * @Param {Vlucht } toeTeVoegenVlucht - De vlucht die we in de lijst willen steken * @Return {bool} */ public static bool VoegVluchtToeAanLijst(Vlucht toeTeVoegenVlucht) { if (toeTeVoegenVlucht != null && !vluchtLijst.ContainsKey(toeTeVoegenVlucht.VluchtNummer)) { vluchtLijst.Add(toeTeVoegenVlucht.VluchtNummer, toeTeVoegenVlucht); return(true); } return(false); }
static void printVluchtInVluchtLijst(int vluchtNummer) { Vlucht gevondenVluchtInLijst = Vlucht.ZoekVluchtOpVluchtnummer(vluchtNummer); if (gevondenVluchtInLijst != null) { Console.WriteLine("Vlucht met vluchtnummer {0} gevonden in de vlucht lijst: ", vluchtNummer); gevondenVluchtInLijst.PrintVluchtInfo(); } else { Console.WriteLine("Vlucht met vluchtnummer {0} niet gevonden in de vlucht lijst.", vluchtNummer); } }
static void Main(string[] args) { Vlucht v1 = new Vlucht(); v1.PrintVluchtInfo(); Vlucht v2 = new Vlucht(); v2.PrintVluchtInfo(); Console.WriteLine(); printVluchtInVluchtLijst(v2.VluchtNummer); Console.WriteLine(); Vlucht.VerwijderVluchtVanLijst(v2); printVluchtInVluchtLijst(v2.VluchtNummer); Console.WriteLine(); Vlucht.VoegVluchtToeAanLijst(v2); printVluchtInVluchtLijst(v2.VluchtNummer); }