In my api Asp.Net Core 3.1, I have some controllers that receive viewModel, but when I post, the model arrives empty in the controller.
My ClientViewModel:
public class ClientViewModel
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public IEnumerable<OperationViewModel> Operations { get; set; }
}
My Add ClientController:
[HttpPost]
public async Task<ActionResult<ClientViewModel>> Add(ClientViewModel clientViewModel)
{
//...
}
Post Json:
{
"id": 0,
"name": "Bradesco",
"operations":[]
}
This happens to me on any controller that receives a model, put, post. I don't know what can be.