public void DisplayBoatMenu(Member member, Boat boat) { Console.Clear(); Console.WriteLine("╔════════════════════════════════════════════════════════════════╗"); Console.WriteLine("║ █▓▒░ BOAT MEMBERSHIP - BOAT ░▒▓█ ║"); Console.WriteLine("╠════════════════════════════════════════════════════════════════╣"); Console.WriteLine("║ Boat type: {0,15} ║", boat.BoatType.ToString()); Console.WriteLine("║ Boat length: {0,15} meters ║", boat.Length); Console.WriteLine("╠════════════════════════════════════════════════════════════════╣"); Console.WriteLine("║ 1: Edit boat ║"); Console.WriteLine("║ 2: Remove boat ║"); Console.WriteLine("╠════════════════════════════════════════════════════════════════╣"); Console.WriteLine("║ 0: Back to member menu ║"); Console.WriteLine("╚════════════════════════════════════════════════════════════════╝"); Console.WriteLine(); }
private void HandleEditBoat(Member member, Boat boat) { boatView.DisplayBoatTypeMenu(); var inputValue = memberView.GetIntegerInput(5, "Current type: " + boat.BoatType.ToString() + ", new boat type", 0); if (inputValue == 0) { return; } var boatType = (BoatType)(inputValue - 1); var boatLength = memberView.GetDoubleInput(100.0, "Current length: " + boat.Length + ", new boat length (meters)", 1.0); boatManager.Update(boat, boatLength, boatType); }
private void HandleRemoveBoat(Member member, Boat boat) { var confirmRemove = memberView.GetConfirm("Are you sure you want to remove this boat?"); if (confirmRemove) { boatManager.RemoveBoat(boat); } }
public void Update(Boat boatInfo, double length, BoatType type) { var boat = Boats.FirstOrDefault<Boat>(b => b == boatInfo); boat.Update(length, type); }
public int AddBoat(double length, BoatType type) { var boat = new Boat(length, type); Boats.Add(boat); return Boats.Count - 1; }
public void RemoveBoat(Boat boat) { Boats.Remove(boat); }