Here is class Report
. I want to make Comment
and ReasonIds
required if value of Score
is less than 4. I can't use attribute validation because you can't use field as attribute argument. How can i validate these fields in ASP.NET MVC core application?
public class Report
{
public int Score { get; set; }
public string Comment { get; set; }
public int[] ReasonIds { get; set; }
}