示例#1
0
        private void DeleteBoat(Member member, Boat boat)
        {
            _pv.ViewMessage("\nÄr du säker? [j=ja, övriga=nej]", ConsoleColor.Yellow, ConsoleColor.Black);

            if (Console.ReadKey().Key == ConsoleKey.J)
            {
                try
                {
                    member.Boats.Remove(boat);
                    _pv.ViewMessage("\n\nBåten togs bort\n", ConsoleColor.Green, ConsoleColor.Black);
                }
                catch (Exception)
                {
                    _pv.ViewMessage("\n\nBåten kunde inte tas bort\n", ConsoleColor.Red);
                }
            }
            Console.WriteLine();
        }
示例#2
0
        private void EditBoat(Member member, Boat boat)
        {
            _pv.ViewHeader("Ändra båt - Tom rad anger tidigare värde");

            string type = _pv.ReadBoatType(boat.Type);
            double length = _pv.ReadBoatLength(boat.Length);
            string info = _pv.ReadBoatInfo(boat.Info);

            // Ersätt befintlig båt med uppdaterad båt
            int index = member.Boats.IndexOf(boat);
            member.Boats[index] = new Boat(type, length, info);

        }
示例#3
0
        private Boat CreateBoat()
        {
            _pv.ViewHeader("Skapa ny båt");
            string boatType = _pv.ReadBoatType();

            if (boatType == null)
                return null;

            double length = _pv.ReadBoatLength();

            string info = _pv.ReadBoatInfo();

            Boat boat = new Boat(boatType, length, info);

            return boat;
        }