public HttpResponseMessage UpdateConfig(int id, JObject moveTaskParams) { //Associate the JSON string to an object dynamic json = moveTaskParams; //This logic displays for discovering which data is the label for the row not the value //Create Lists for the calculation List<OutputListGroup> OutputList = new List<OutputListGroup>(); List<List<OutputListGroup>> BulkOutputList = new List<List<OutputListGroup>>(); //Builds calculation and creates a further object with all of the calculations foreach (var group in json.data) { List<CategoryViewModel> jCategory = (List<CategoryViewModel>)javaScriptSerializer.Deserialize(Convert.ToString(group), typeof(List<CategoryViewModel>)); List<ConfigViewModel> jConfig = (List<ConfigViewModel>)javaScriptSerializer.Deserialize(Convert.ToString(group), typeof(List<ConfigViewModel>)); Calculate Calculate = new Calculate(); OutputList = Calculate.OutputResults(jCategory); BulkOutputList.Add(OutputList); } BulkOutputListBuilder BulkBuilder = new BulkOutputListBuilder(); //Create object response var response = Request.CreateResponse(); response.Content = new StringContent(JsonConvert.SerializeObject((BulkBuilder.BulkOutput(BulkOutputList)))); response.StatusCode = HttpStatusCode.OK; return response; }
public HttpResponseMessage UpdateConfig(int id, JObject moveTaskParams) { //Associate the JSON string to an object dynamic json = moveTaskParams; List<List<OutputListGroup>> BulkOutputList = new List<List<OutputListGroup>>(); foreach (var group in json.data) { List<OutputListGroup> OutputGroup = new JavaScriptSerializer().Deserialize<List<OutputListGroup>>(Convert.ToString(group)); BulkOutputList.Add(OutputGroup); } BulkOutputListBuilder BulkBuilder = new BulkOutputListBuilder(); //Create object response var response = Request.CreateResponse(); response.Content = new StringContent(JsonConvert.SerializeObject((BulkBuilder.BulkOutput(BulkOutputList)))); response.StatusCode = HttpStatusCode.OK; return response; }