I have the following defined HTTPPost Task in a controller which is usually called by AJAX
Task definition
 [HttpPost("MyFunction")]
 public async Task<JsonResult> MyFunction([FromBody] Model model){...}
AJAX
$.ajax({
                type: "POST",
                url: "/Controller/MyFunction",
                beforeSend: function (xhr) {
                    xhr.setRequestHeader("XSRF-TOKEN",
                        $('input:hidden[name="__RequestVerificationToken"]').val());
                },
                data: JSON.stringify({
                    ID: id,
                    Value: value,
                }),
...........
I would like to call the task defined above in a different .net class, and not AJAX. What would be the most efficient way to achieve this?
Thanks