I want to pass data what has list of child like here
{
id : 1,
title : 'test',
childs : [
{ id : 1, name: 'name1' },
{ id : 2, name: 'name2' },
{ id : 3, name: 'name3' }]
}
I want it pass to web api controller
public IHttpActionResult Post(Batche model){
return model;
}
and batch
public class Batche
{
public long Id { get; set; }
public string title{ get; set; }
public ICollection<BatchDetail.BatchDetail> BatchDetails { get; set; }
}
and batch details
public class BatchDetails(){
public long Id { get; set; }
public string Name{ get; set; }
}
when I post data get me null
$http({
method : 'POST',
url : baseUrl + "api/MyController",
data : $scope.model
})
Use [FromBody] before your method parameter
public IHttpActionResult Post([FromBody]Batche model){
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With