title: How to call a method in controller from console application
body: <p>I have tried to call a method in controller (mvc) from console application.It has integer value as parameter.How to pass the integer value from console application to controller as parameter.How to run this and check.</p>
  
  <p>Method call from console application:</p>
  
  <pre><code>public class Program
  {
      public static void Main()
      {
  
  
          var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://localhost:60035/AddDataToDataBaseController/AddData");
          httpWebRequest.ContentType = "application/json";
          httpWebRequest.Method = "POST";
          var response = (HttpWebResponse)httpWebRequest.GetResponse();
          var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
  
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>controller method:</p>
  
  <pre><code>[AllowAnonymous]
      [HttpPost]
      public JsonResult AddData(int fileDetailsId)
      {
          var response = new ResponseDTO();
          FileDetails fileDetails = _addingDataDl.GetFileDetails(fileDetailsId);
          bool hasKnowParts = false;
          FileProcess fileProcess = _addingDataDl.GetFileProcess(fileDetailsId, Enumerations.ProcessType.Parsed);
          try
          {
              Entities.User user = _userRepository.GetUserByUserName(User.Identity.Name);
              if (fileDetails != null)
  </code></pre>