Ejemplo n.º 1
0
        public void AddMember()
        {
            view.AddMember();
            string firstname       = view.getUserName();
            string lastname        = view.getLastName();
            int    socialSecNumber = view.getSocialSecurityNumber();

            mm.AddMember(firstname, lastname, socialSecNumber);
            view.UserIsAdded();
            view.ContinueOnKeyPressed();
            Menu();
        }
Ejemplo n.º 2
0
        public void AddMember(MemberModel member)
        {
            string name;
            int    bday;

            Console.Clear();
            Console.WriteLine("Enter name");
            name = Console.ReadLine();

            while (true)
            {
                try
                {
                    Console.WriteLine("Enter birthday, 10 numbers");
                    bday = Int32.Parse(Console.ReadLine());

                    if (bday.ToString().Length != 10)
                    {
                        throw new ArgumentOutOfRangeException();
                    }
                    break;
                }
                catch (Exception)
                {
                    Console.WriteLine("Birthday not correctly entered");
                }
            }
            try
            {
                member.AddMember(name, bday);
                Console.WriteLine("Member saved");
            }
            catch (Exception)
            {
                Console.WriteLine("Member could not be saved");
            }
            SafeExit();
        }