Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
Why is Fetch body going always null

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using new Object(); causes this error, instead use new StatisticFormDTO();

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!