0
I’m creating a Dotnet API, and when I tried to test a Post request with Postman the only data coming to my controller’s method is Name and CPF.
Below is an image with the request I’m making in Postman
Below the class of the object I am passing via Post.
using System.ComponentModel.DataAnnotations;
namespace PimVIIIAPI.Model
{
public class Pessoa
{
[Key]
protected int Id { get; set; }
[Required(ErrorMessage = "Informe o nome")]
public string Nome { get; set; }
[Required(ErrorMessage = "Informe o cpf")]
public long Cpf { get; set; }
[Required(ErrorMessage = "Informe o endereço")]
public Endereco Endereco = new Endereco();
public Telefone[] Telefone = new Telefone []{new Telefone()};
}
}
I cannot understand why all data is not being received.
I believe I have created the request correctly and passed the object in the correct way.
I get it, I’m taking this test today, thank you......
– Nelson Francisco
It didn’t work I’ll keep trying, in the case of the dynamic object I received the data correctly but I can’t pass them to my object of type Person the way you passed me the example.
– Nelson Francisco