Exemplo n.º 1
0
        public IList<Contact> GetContactsByGroup(ContactGroup contactGroup)
        {
            try
            {
                var result = _contacts.Where(c => c.ContactGroupId == contactGroup.Id).ToList();

                return result;
            }
            catch (Exception ex)
            {
                Trace.WriteLine("GetAllGroups: " + ex.Message);

                throw;
            }
        }
Exemplo n.º 2
0
        public void AddContactToGroup(Contact contact, ContactGroup contactGroup)
        {
            if (contact == null)
                throw new ArgumentNullException("contact");
            if (contactGroup == null)
                throw new ArgumentNullException("contactGroup");

            try
            {
                var foundContact = _contacts.FirstOrDefault(c => c.Id == contact.Id);
                if (foundContact != null)
                    foundContact.ContactGroupId = contactGroup.Id;
            }
            catch (Exception ex)
            {
                Trace.WriteLine("AddContactToGroup: " + ex.Message);

                throw;
            }
        }