private void CreateServiceProperties(HttpContext context) { Int16 serviceId = 0; JObject propertyObject = null; JArray propertyFieldsArray = null; List <ServiceProperty> servicePropertiesList = new List <ServiceProperty>(); List <ServicePropertyFields> servicePropertiesFieldList = new List <ServicePropertyFields>(); if (context.Request["ServiceId"] == null || !Int16.TryParse(context.Request["ServiceId"].ToString(), out serviceId)) { GenerateErrorResponse(400, string.Format("Parameter ServiceId is missing or not a valid number")); } try { propertyObject = JObject.Parse(context.Request["Properties"].ToString()); } catch (Exception e) { GenerateErrorResponse(400, string.Format("Invalid JSON")); } //foreach (JObject propertyObject in properiesArray) //{ try { propertyFieldsArray = JArray.Parse(propertyObject.SelectToken("PropertyFields").ToString()); } catch (Exception ex) { GenerateErrorResponse(400, string.Format("Invalid JSON")); } ServiceProperty serviceProperty = ValidateServiceProperties(propertyObject); servicePropertiesFieldList = ValidateServicePropertyFields(propertyFieldsArray, serviceProperty); //servicePropertiesList.Add(serviceProperty); //} OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); context.Response.Write(client.CreateServiceProperties(serviceId, serviceProperty, servicePropertiesFieldList)); }