1
I am trying to return a Jsonresult to my View, but it is returning the following error.
"Jsonresult" does not contain a constructor that accepts 0 arguments
You could help me friends ?
[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 };
}
On the Return line I’m getting the error I mentioned above, could help me ?
Yeah. Net Core, right? Try it without the
JsonRequestBehavior = JsonRequestBehavior.AllowGet
, thusreturn new JsonResult(new { Data = events })
. I’m on the phone and Jaja Gero a reply.– Barbetta