title: C# MVC Post Model and additional data to controller from js
body: <p>I am working with a custom workflow solution that I am creating.  I would like to create a postback that has the model, and two integer values that represent the action and step that I have completed.  I don't want to add them to the model because they are only used in this one place.  The signature for this postback would be something like this.</p>
  
  <pre><code>[HttpPost]
  public void ProcessWorkflowAction(EditScreenModelValidation model, int stepActionId, int stepNumber)
  {
      //Some work on model and actions
  }
  </code></pre>
  
  <p>I would really like to do this through JS because that is currently how I am getting StepActionId and StepId.  Is there a way to package up the model to send through JS?</p>
  
  <pre><code> var modelObj = CreateModelData();
   var postObj = JSON.stringify(modelObj);
   $.ajax({
          type: "POST",
          traditional: true,
          dataType: "json",
          url: "url",
          data: { model: modelObj, stepActionId: stepId, stepNumber: 3 }
          cache: false,
          complete: function (data) {
          }});
  
  CreateModelData = function () {
      var modelObj = {};
      var modelArray = $('#frm').serializeArray()
      $.each(modelArray, function (index, value) {
          assign(modelObj, value.name, value.value);
      })
  
      return modelObj;
  };
  
  function assign(obj, prop, value) {
      if (prop != undefined) {
          if (typeof prop === "string")
              prop = prop.split(".");
  
          if (prop.length &gt; 1) {
              var e = prop.shift();
              assign(obj[e] =
                       Object.prototype.toString.call(obj[e]) === "[object Object]"
                       ? obj[e]
                       : {},
                     prop,
                     value);
          } else
              obj[prop[0]] = value;
      }
  }
  </code></pre>
  
  <p>The model comes back as null in the controller.  I have also tried the following code with the same result.</p>
  
  <pre><code>$.ajax({
          type: "POST",
          traditional: true,
          dataType: "json",
          url: "url",
          data: { model: $('#frm').serializeArray(), stepActionId: stepId, stepNumber: 3 }
          cache: false,
          complete: function (data) {
          }});
  </code></pre>