I have this class:
public class StatisticFormDTO
{
public StatisticFormDTO()
{
FilterIds = new List<int>();
}
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public IList<int> FilterIds { get; set; }
}
[HttpPost]
public async Task<IActionResult> GetStatsBySalesman([FromBody] StatisticFormDTO parameters)
{}
and in the view
let data = new Object();
data.startDate = startDate;
data.endDate = endDate;
data.filterIds = provenanceIds;
let json = JSON.stringify(data);
let url = "/Dossiers/GetStatsBySalesman";
await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: json
})
I'm using asp .net 5.0 mvc, the parameter allways come null. I've did it this way many times and always works fine. I'd appretiate some help
Using new Object(); causes this error, instead use new StatisticFormDTO();