public void AddMember(Member member)
 {
     var highestID = MemberList.Count == 0 ? 0 : MemberList.Max(m => m.UniqueID);
     member.UniqueID = highestID + 1;
     MemberList.Add(member);
     Save();
 }
 public void ShowBoatList(Member member)
 {
     WriteLine($"{member.GetBoatCount()} boat(s):");
     foreach (Boat boat in member.Boats)
     {
         WriteLine($"TYPE: {boat.GetTypeString()}, LENGTH: {boat.Length}m");
     }
 }
        public void EditMember(Member oldMember, Member newMember)
        {
            newMember.UniqueID = oldMember.UniqueID;
            newMember.Boats = oldMember.Boats;
            int index = MemberList.IndexOf(oldMember);
            MemberList[index] = newMember;

            Save();
        }
        public void ShowMenu(Member member)
        {
            //Console.Clear();
            WriteLine("--- UPDATE MEMBER ---");
            WriteLine($"NAME: {member.Name}");
            WriteLine($"PersonalNumber: {member.PersonalNumber}");
            WriteLine($"ID: {member.UniqueID}");

            if (member.GetBoatCount() != 0)
            {
                ShowBoatList(member);
            }

            ShowInstructions();
        }
        public Boat Find(Member member, bool isDeleting)
        {
            Clear();

            for (int i = 0; i < member.Boats.Count; i++)
            {
                WriteLine($"ID:{ i + 1 }, TYPE: { member.Boats[i].Type }, LENGTH: { member.Boats[i].Length  }m");
            }

            string status = isDeleting ? "remove" : "update";
            Write($"Enter ID of boat to {status}:");
            int input = Convert.ToInt32(ReadLine());

            Boat chosenBoat = member.Boats[input - 1];

            Boat toRemove = member.Boats.Find(b => b == chosenBoat);

            return toRemove;
        }
 public override void ShowInstructions(Member member)
 {
     if (member.GetBoatCount() == 0)
     {
         WriteLine("This user has no boats registered.");
         WriteLine("Press:");
         WriteLine("      A to add new boat");
         WriteLine("      M to return to main menu");
     }
     else
     {
         ShowBoatList(member);
         ShowOptionsHeader();
         WriteLine("Press:");
         WriteLine("      A to add new boat");
         WriteLine("      R to remove a boat");
         WriteLine("      U to update a boat");
         WriteLine("      M to return to main menu");
     }
 }
        public Member GetInput(Member memberToUpdate = null)
        {
            Clear();
            string name;
            string personalNumber;

            bool isUpdating = memberToUpdate != null;

            if (isUpdating)
            {
                WriteLine($"You are updating a user with name: {memberToUpdate.Name}, personal nr: {memberToUpdate.PersonalNumber}.");
            }

            name = GetName(isUpdating);

            personalNumber = GetPersonalNumber(isUpdating);

            Member member = new Member(name, personalNumber);

            return member;
        }
 public void ShowChangeMessage(Member member, string action)
 {
     WriteLine($"Member with name \"{member.Name}\" and personalnumber {member.PersonalNumber} successfully {action}.");
 }
 public virtual void ShowInstructions(Member member)
 {
     
 }
 public void UpdateBoatOnMember(Member member, Boat oldBoat, Boat newBoat)
 {
     Member foundMember = MemberList.Find(m => m == member);
     foundMember.EditBoat(oldBoat, newBoat);
     Save();
 }
 public void RemoveMember(Member toRemove)
 {
     MemberList.Remove(toRemove);
     Save();
 }
 public void RemoveBoatFromMember(Member member, Boat boat)
 {
     Member foundMember = MemberList.Find(m => m == member);
     foundMember.RemoveBoat(boat);
     Save();
 }
 public void AddBoatToMember(Member member, Boat boat)
 {
     Member foundMember = MemberList.Find(m => m == member);
     foundMember.AddBoat(boat);
     Save();
 }