Exemple #1
0
        private static void AddAddress(ContactService contactService)
        {
            DisplayAllContacts(contactService);
            Console.Write($"Enter the Id of contact you wish to add address : ");

            int     idOfContact = Int32.Parse(Console.ReadLine());
            Contact contact     = contactService.GetContactById(idOfContact);

            Console.Write("Enter Location for the Addresses : ");
            string addressLocation = Console.ReadLine();

            try
            {
                contactService.AddAddress(contact, new Address()
                {
                    Location = addressLocation
                });
                Console.WriteLine("address addded successfully");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }