Angular 2 Code Request URl: http://loacalhost:8800/MyController/SaveBookings
let data = {
occupationListStr: occupations,
rOccupationListStr: roccsStr,
};
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
this.http.post('MyController/SaveBookings', JSON.stringify(data),options)
.then(res => {
return res.json()
})
.catch(this.handleError);
C# code
Controller
Issue: Request.QueryString values occupationListStr and rOccupationListStr are null
public ActionResult SaveBookings()
{
dynamic occupationListStr = Request.QueryString["occupationListStr"];
dynamic rOccupationListStr = Request.QueryString["rOccupationListStr"];
<....Do something.....>
return <return something>;
}