Forum Discussion

MarcosMarchette's avatar
MarcosMarchette
Copper Contributor
Apr 12, 2024

Ajax to Controller bind model

Guys, good afternoon,
I'm working on an application in which it makes javascript ajax requests to the backend
An error occurs when I send a structure this way:

" const OFManutencaoViewModel = {
Justification: Justification,
RequesterJustification: idOFJustificationRequestor,
EmailsJustifications: idListaOFJustificationEmails,
OFBecalhoViewModel: oFCabecalhoViewModel
}
"

Properly populated according to the payload (attached image) below:

 

  


My model is structured like this:

public class OFManutencaoViewModel
{

public OFBecalhoViewModel OFBecalhoViewModel { get; set; }

public string Justification { get; set; }

public string RequesterJustification { get; set;}

public string EmailsJustifications { get; set; }
}

When making the call it hits the controller but with null values

Method structure (image attached):

I've already checked property by property and everything is correct.

Could someone give me some help

No RepliesBe the first to reply

Resources