title: Angular2 HTTP Post ASP.NET MVC Web API
body: <p>How do you properly create a Web API POST of complex object or multiple parameters using Angular2?</p>
  
  <p>I have a service component in Angular2 as seen below:</p>
  
  <pre><code>public signin(inputEmail: string, inputPassword: string): Observable&lt;Response&gt; {
      return this.http.post('/api/account/signin', JSON.stringify({ Email: inputEmail, Password: inputPassword}), this.options);
  }
  </code></pre>
  
  <p>The targeted web api is seen below:</p>
  
  <pre><code>[HttpPost]
  [Route("signin")]
  public async Task&lt;IActionResult&gt; Signin(string email, string password)
  {
         ....
  }
  </code></pre>
  
  <p>This does not work because I need to convert the parameters of the web api into a single POCO class entity with Email and Password properties and put the [FromBody] attribute: <code>Signin([FromBody] Credential credential)</code></p>
  
  <p>Without using <code>[FromURI]</code> (POST requests with query strings?), how can I make POSTs of multiple parameters or complex objects without converting these parameters into a single POCO class?</p>
  
  <p>Because what if I have numerous Web API POST actions with parameters like <code>(string sensitiveInfo1, string name, int sensitiveInfo2)</code> or <code>(ClassifiedInfo info, string sensitiveInfo1, string sensitiveInfo2)</code>, do I need to convert them all to POCO classes and always use [FromBody]?</p>
  
  <p>PS.
  I was using <code>RestangularJS</code> before and it can posts anything (mulitple primitive objects and complex objects) without my Web API actions having <code>[FromBody]</code> attributes. Will about to investigate how RestangularJS do it.</p>