コード例 #1
0
        public async Task <Guid> AddContactAsync(Contact contact)
        {
            // First we will fetch address book along with the contact we are trying to add.
            // This is just in case the contact already exists.
            var addressBook = await _addressBookRepository.GetContactAsync(contact.Name, contact.Address);

            addressBook.RegisterNewContact(contact);
            await _addressBookRepository.SaveAsync(addressBook);

            return(contact.Id);
        }