I know this is an old post
If you use non-nullable types (like int
, DateTime
), they always have a default value (e.g., 0), so [Required]
won’t catch them being "empty."
Fix: Use nullable types if you want [Required]
to validate them:
[Required]
public int? AquiferID { get; set; }