DNSimple.DNSimpleRestClient.UpdateContact C# (CSharp) Méthode

UpdateContact() public méthode

Updates an existing Contact. Makes a PUT request to the Contacts List resource.
public UpdateContact ( int id, string first_name, string last_name, string address1, string city, string state_province, string postal_code, string country, string email_address, string phone, string organization_name = null, string job_title = null, string fax = null, string phone_ext = null, string label = null, string address2 = null ) : dynamic
id int The id of the Contact to Update
first_name string First Name
last_name string Last Name
address1 string Address Line 1
city string City
state_province string State or Province
postal_code string Postal Code
country string Country
email_address string Email Address
phone string Phone Number
organization_name string Optional Organisation Name
job_title string Optional Job Title (Required if organisation_name specified)
fax string Optional Fax Number
phone_ext string Optional Phone Extension
label string Optional Label for this Contact
address2 string Address Line 2
Résultat dynamic
        public dynamic UpdateContact(int id, string first_name, string last_name, string address1, string city, string state_province, string postal_code,
            string country, string email_address, string phone, string organization_name = null, string job_title = null,
            string fax = null, string phone_ext = null, string label = null, string address2 = null)
        {
            Require.Argument("id", id);
            Require.Argument("first_name", first_name);
            Require.Argument("last_name", last_name);
            Require.Argument("address1", address1);
            Require.Argument("city", city);
            Require.Argument("state_province", state_province);
            Require.Argument("postal_code", postal_code);
            Require.Argument("country", country);
            Require.Argument("email_address", email_address);
            Require.Argument("phone", phone);

            if (!string.IsNullOrWhiteSpace(organization_name))
            {
                Require.Argument("job_title", job_title);
            }

            var request = new RestRequest(Method.PUT)
            {
                RequestFormat = DataFormat.Json,
                Resource = "contacts/{id}"
            };
            request.AddUrlSegment("id", id.ToString());

            dynamic payload = new ExpandoObject();
            payload.contact = new ExpandoObject();
            payload.contact.first_name = first_name;
            payload.contact.last_name = last_name;
            payload.contact.address1 = address1;
            payload.contact.city = city;
            payload.contact.state_province = state_province;
            payload.contact.postal_code = postal_code;
            payload.contact.country = country;
            payload.contact.email_address = email_address;
            payload.contact.phone = phone;
            if (!string.IsNullOrWhiteSpace(organization_name))
            {
                payload.contact.organization_name = organization_name;
            }
            if (!string.IsNullOrWhiteSpace(job_title))
            {
                payload.contact.job_title = job_title;
            }
            if (!string.IsNullOrWhiteSpace(fax))
            {
                payload.contact.fax = fax;
            }
            if (!string.IsNullOrWhiteSpace(phone_ext))
            {
                payload.contact.phone_ext = phone_ext;
            }
            if (!string.IsNullOrWhiteSpace(label))
            {
                payload.contact.label = label;
            }
            if (!string.IsNullOrWhiteSpace(address2))
            {
                payload.contact.address2 = address2;
            }
            request.AddBody(payload);

            return Execute<dynamic>(request);
        }