When applied to the member of a type, specifies that the member is not part of a data contract and is not serialized.
public class PersonViewModel{ public int Id { get; set; } public string Name { get; set; } [IgnoreDataMember] public int Car_Id { get; set; }
}
The following request would suffice when using a PUT statement to update the record:
{
"Id": 1,
"Name": "Bob"
}
You can fill the id later on in the controller and still maintain one viewmodel.
In my case I had to fill the id from a user claim which was not exposed to the frontend.
Cheers!