public void showSelectedMenu() { Console.WriteLine("ShowSelectedMenu i BoatController"); BoatView.MenuChoice menuChoice = this.boatView.GetMenuChoice(); if (menuChoice == BoatView.MenuChoice.AddBoat) { Console.WriteLine("Add boat"); this.boatView.addBoat(); BoatModel boat = new BoatModel(boatView.getBoatType(), boatView.getBoatLength()); this.memberDAL.saveBoat(this.selectedMember, boat); MemberView editedMemberView = new MemberView(this.selectedMember); editedMemberView.showMember(); } if (menuChoice == BoatView.MenuChoice.EditBoat) { this.boatView.listMemberBoats(); } if (menuChoice == BoatView.MenuChoice.DeleteBoat) { this.boatView.listMemberBoats(); } if (menuChoice == BoatView.MenuChoice.StartMenu) { StartMenuController startController = new StartMenuController(); } }
public void saveBoat(string memberId, BoatModel boat) { using (StreamWriter write = File.AppendText(this.folderPath + memberId + ".txt")) { write.WriteLine(boat.getBoatType().ToString()); write.WriteLine(boat.getBoatLength()); } }
public void ReadXml(XmlReader reader) { reader.MoveToContent(); reader.ReadStartElement(); _id = reader.ReadElementContentAsInt("Id", reader.NamespaceURI); _model = (BoatModel)reader.ReadElementContentAsInt("Model", reader.NamespaceURI); _length = reader.ReadElementContentAsDouble("Length", reader.NamespaceURI); reader.ReadEndElement(); }