コード例 #1
0
 void HandleContact(XmlElement contactsXml, Contact contact)
 {
     var contactXml = contactsXml.AddElement("Contact");
       contactXml.SetAttribute("href", string.Format("{0}/contacts/{1}", this.baseUri, contact.ContactId));
       contactXml.AddElement("Name", contact.Name);
       contactXml.AddElement("Address", contact.Address);
       contactXml.AddElement("City", contact.City);
       contactXml.AddElement("State", contact.State);
       contactXml.AddElement("Zip", contact.Zip);
       contactXml.AddElement("Email", contact.Email);
       HandleTwitter(contactXml, contact);
 }
コード例 #2
0
 public void Update(Contact updatedContact)
 {
     var contact = this.Get(updatedContact.ContactId);
       contact.Name = updatedContact.Name;
       contact.Address = updatedContact.Address;
       contact.City = updatedContact.City;
       contact.State = updatedContact.State;
       contact.Zip = updatedContact.Zip;
       contact.Email = updatedContact.Email;
       contact.Twitter = updatedContact.Twitter;
 }
コード例 #3
0
 public void Post(Contact contact)
 {
     contacts.Add(contact);
 }
コード例 #4
0
        void HandleTwitter(XmlElement contactXml, Contact contact)
        {
            if (contact.Twitter != null)
              {
            var twitterXml = contactXml.AddElement("Twitter");
            twitterXml.SetAttribute("user", "gblock"); // SB logged-in user

            var tweetsXml = twitterXml.AddElement("Tweets");
            tweetsXml.SetAttribute("href", string.Format("{0}/contacts/{1}/tweets", this.baseUri, contact.ContactId));

            var dmXml = twitterXml.AddElement("DM");
            var field = dmXml.AddElement("Field", "Message");
            dmXml.SetAttribute("href", string.Format("{0}/contacts/{1}/dm", this.baseUri, contact.ContactId)); ;

            var mentionXml = twitterXml.AddElement("Mention");
            field = mentionXml.AddElement("Field", "Message");
            mentionXml.SetAttribute("href", string.Format("{0}/contacts/{1}/mention", this.baseUri, contact.ContactId));
              }
        }