After a user fills out a form, I need post the form contents back in JSON and get a chunk of HTML back for display. This seems like a good case for razor pages. The BrandTemplateInfo parameter on the OnPost handler is always null. I can't seem to get the BrandTemplateInfo to populate from the model binder. What am I missing here? This used to be easy with MVC controllers. What am I missing here? Help?
public class PayNowCardModel : PageModel
{
public void OnGet()
{
}
public IActionResult OnPost([FromBody] BrandTemplateInfo brandTemplateInfo)
{
return Page();
}
public BrandTemplateInfo BrandTemplateInfo { get; set; }
}
HTTP Request:
POST /terms/paynowcard HTTP/1.1
Host: xxxxxxxx
Content-Type: application/json
Cache-Control: no-cache
{
"userForm": {
"cardNumber": "4111111111111111",
"paymentAmount": 123.33
},
"account": {
"Creditor": {
"Name": "big time creditor"
},
"accountId": "32432432432423"
}
}