I have a viewmodel with an Id property
[Required]
public int Id { get; set; }
But I think this attribute is working only for string properties.
When no Id is set, Id has value 0 and the model is valid.
How can I enforce that if no value for a int property is set, the model will be invalid ?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)