title: Angular asp.net mvc calling c# controller function
body: <p>I tried a bunch of stuff and this is what i have so far:</p>
  
  <p>So i try to call this method "runTest()" from my javascript.
  The method does not actually go, and it goes through as a success, so the "handleTest()" goes and also succeeds. I need it to actually call the controller function.</p>
  
  <p><strong>Javascript/Angular/JQuery</strong></p>
  
  <pre><code>$scope.runTest = function (myTest) {
      $.ajax({
          method: 'POST',
          Url: 'Tests/runTest',
          contentType: 'application/json;',
          data: myTest,
          success: function () { handleTest(myTest); },
          error: function () { alert('no object found'); }
      });
  }
  
  function handleTest(currentTest){
      var updated = { id: currentTest.id, name: currentTest.name, schedule: currentTest.schedule, description: currentTest.description, server: currentTest.server, port: currentTest.port, method: currentTest.method };
      //var updated = currentTest;
      $http({
          method: "PUT",
          url: 'http://~~api address~~/api/tests/' + (currentTest.id),
          data: updated
      })
      .success(function (data, status, headers) {
          alert("Test was successfully updated.");
          $state.reload();
      })
      .error(function (data, status, headers) {
          alert("Test could not be updated.");
          $state.reload();
      });
  }
  </code></pre>
  
  <p><strong>C# controller method</strong>
  (named TestsController)</p>
  
  <pre><code>[HttpPost]
  public ActionResult runTest(StandardTest myTest)
  {
      myTest.lastResult = MyEnum.Pass;
      log.Info(myTest.name + " " + myTest.lastResult + " " + myTest.id);
      return Json(myTest, JsonRequestBehavior.AllowGet);
  }
  </code></pre>
  
  <p>Any help would be so so appreciated.</p>