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
Change the type to Nullable (shortcut int?) to allow null values.
int?
null