Exemplo n.º 1
0
        public bool confirmMemberToEdit(MemberModel member)
        {
            string inputString = "";

            System.Console.WriteLine(member.UserName);

            System.Console.WriteLine("Is this the member you would like to edit? y/n \n");

            while (true)
            {
                inputString = getInput();

                if (inputString.ToLower() == "yes" || inputString.ToLower() == "y")
                {
                    return(true);
                }
                if (inputString.ToLower() == "no" || inputString.ToLower() == "n")
                {
                    return(false);
                }
            }
        }
Exemplo n.º 2
0
        public void editUserInformation(MemberModel member)
        {
            bool success = false;

            try
            {
                bool correctMember = _memberView.confirmMemberToEdit(member);

                if (correctMember)
                {
                    MemberModel editedMember = _memberView.memberToEdit(member);
                    _storage.saveEditedUser(editedMember);
                }
                else
                {
                    return;
                }

                if (member != null)
                {
                    success = true;
                }

                if (!success)
                {
                    throw new ArgumentException();
                }
                else
                {
                    System.Console.WriteLine("Membername: " + member.UserName + "\nPersonal number: " + member.PersonalNumber);
                }
            }
            catch (Exception)
            {
                System.Console.WriteLine("Something went wrong when getting the user");
            }
        }
Exemplo n.º 3
0
 public void displayMember(MemberModel member)
 {
     printSectionSeparationLine();
     printCustomMessage("ID: " + member.ID + ", Name: " + member.UserName + ", Personal number: " + member.PersonalNumber);
     printSectionSeparationLine();
 }
Exemplo n.º 4
0
 public void saveEditedUser(MemberModel member)
 {
     deleteMember(member);
     Members.Add(member);
     saveToFile(Members);
 }
Exemplo n.º 5
0
 public void updateMember(MemberModel member)
 {
     deleteMember(getMemberByID(member.ID));
     Members.Add(member);
     saveToFile(Members);
 }
Exemplo n.º 6
0
 public void deleteMember(MemberModel member)
 {
     Members.Remove(member);
     saveToFile(Members);
 }