Cucumber.SimpleDb.Transport.SimpleDbRestService.PutAttributes C# (CSharp) Method

PutAttributes() public method

public PutAttributes ( string domain, string itemName ) : System.Xml.Linq.XElement
domain string
itemName string
return System.Xml.Linq.XElement
        public XElement PutAttributes(string domain, string itemName, params object[] attributes)
        {
            var values = new NameValueCollection
            {
                {"Action", "PutAttributes"},
                {"DomainName", domain},
                {"ItemName", itemName}
            };
            int attributeCount = 0;
            try
            {
                foreach (dynamic attribute in attributes)
                {
                    values.Add(
                        string.Format("Attribute.{0}.Name", attributeCount),
                        attribute.Name);
                    values.Add(
                        string.Format("Attribute.{0}.Value", attributeCount),
                        attribute.Value);
                    if (ObjectExtensions.HasMember(attribute, "Replace") && attribute.Replace == true)
                    {
                        values.Add(
                            string.Format("Attribute.{0}.Replace", attributeCount),
                            "true");
                    }
                    if (ObjectExtensions.HasMember(attribute, "When"))
                    {
                        dynamic when = attribute.When;
                        values.Add(
                            string.Format("Expected.{0}.Name", attributeCount),
                            attribute.Name);
                        if (ObjectExtensions.HasMember(when, "Value"))
                        {
                            values.Add(
                                string.Format("Expected.{0}.Value", attributeCount),
                                when.Value);
                        }
                        if (ObjectExtensions.HasMember(when, "Exists"))
                        {
                            values.Add(
                                string.Format("Expected.{0}.Exists", attributeCount),
                                when.Exists.ToString());
                        }
                    }
                    attributeCount++;
                }
            }
            catch (Exception ex)
            {
                throw new FormatException("One or more item definitions did not contain the expected properties", ex);
            }
            return InternalExecute(values);
        }