I want my validation model to be invalid when the entered value for ActionId is not within in array/list of integers
public class AddTerminalInput
{
private List<int> actionIds;
public AddTerminalInput(List<int> actionIds)
{
this.actionIds = actionIds;
}
[Required(AllowEmptyStrings = false)]
public string TerminalId { get; set; } = "";
[Required(AllowEmptyStrings = false)]
public string TerminalName { get; set; } = "";
// ActionId should be only valid if the value is within actionIds
public int ActionId { get; set; } = 1;
}
does anybody know how I can achive this?