I have created a sample for post multiple params in HTTP Request.But i can't able to assign the value in Web Api Controller. Please check the below code.
.ts
deleteEntry(entryId: number, entryActiveFlag: string): Observable<number> {
let dataUrl = `http/localhost:8080/Entry/DeleteEntry`;
let params = { entryId, entryActiveFlag};
//params.append(entryId);
//params.append('entryActiveFlag', entryActiveFlag);
let body = JSON.stringify(params );
return this.http.post(dataUrl, body)
.map(res => res.json())
.catch(this.handleError);
}
.WebApi
[HttpPost("DeleteEntry")]
public IActionResult DeleteEntry([FromBody]int entryId,string entryActiveFlag)
{
return Ok( _service.DeleteEntry(entryId, entryActiveFlag));
}
Wrap the input details in one class and provide the class object as parameter to Web API method. In your case you can add below class -
And your web method will be
Accordingly also change the invocation from client method.