public List <State> GetAllStates()
        {
            using (ContactManagerContext ctx = new ContactManagerContext()) {
                var states = from s in ctx.States
                             select s;

                return(states.ToList());
            }
        }
        public List <Contact> GetAllContacts()
        {
            List <Contact> contacts = null;

            using (ContactManagerContext ctx = new ContactManagerContext()) {
                contacts = (from c in ctx.Contacts
                            .Include("Address")
                            select c).ToList();
            }
            return(contacts);
        }
        public Contact GetContactById(long id)
        {
            Contact contact = null;

            using (ContactManagerContext ctx = new ContactManagerContext()) {
                contact = (from c in ctx.Contacts
                           .Include("Address")
                           where c.ID == id
                           select c).SingleOrDefault();
            }
            return(contact);
        }
        public Contact AddContact(Contact contact)
        {
            if (contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            using (ContactManagerContext ctx = new ContactManagerContext()) {
                ctx.Contacts.Add(contact);

                ctx.SaveChanges();
            }

            return(contact);
        }