I have a viewmodel with an Id property
[Required] public int Id { get; set; }
But I think this attribute is working only for string propert
If you are using a database, you should use the attributes [Key] and [DatabaseGenerated(DatabaseGenerated.Identity)] and Id shouldn't be NULLABLE.
[Key]
[DatabaseGenerated(DatabaseGenerated.Identity)]
Id
NULLABLE