Q:

How to use model binder in .net core mvc with Ajax Post?

I'm new to .net core MVC and am trying to execute an Ajax post similar to .net framework MVC. I'm simply trying to POST a single int value to the controller action below. The Ajax call hits the controller, but the action parameter is always 0. I verified that the correct integer value is being sent in the Ajax request payload. What am I missing?
public class HomeController : Controller
{
    public IActionResult Index()
    {
        return View();
    }

    [HttpPost]
    public IActionResult Ajax_GenerateSecretNum([FromBody]int lower)
    {

        return Json(new { success = true });
    }

  $.ajax({
            url: '@Url.Action("Ajax_GenerateSecretNum", "Home")',
            type: 'POST',
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            data: { lower: lower },
            success: function (response) {

            }
        });

A:

            $.ajax({
                url: '@Url.Action("Ajax_GenerateSecretNum", "Home")',
                type: 'POST',               
                data: { "lower": lower, "upper": upper },
                success: function (response) {

                }   
            });

Changing my jQuery ajax to the above sample solved the issue. I'm not sure why, but it looks like specifying the extra ajax parameters caused the values to fail model binding. After changing the ajax, I was also able to remove the [FromBody] attribute from the controller action.

