I'm trying to return a JsonResult for my View, but it's returning the following error.
"JsonResult" does not contain a constructor that accepts 0 arguments
Would you help me out?
[HttpGet]
public async Task<IActionResult> GetAllSchedule()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
throw new ApplicationException($"Não é possível carregar o usuário com o ID '{_userManager.GetUserId(User)}'.");
}
var events = _scheduleManager.GetAllSchedule(user.Id);
return new JsonResult { Data = events, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
In the return line I'm getting the error I mentioned above, could you help me?