Regex for Web API 2 project - checking if property has required values

I’m working on a Web API 2 project. Besides the requirement that some properties are required, some only can have specific values. (“000000007173”, “000000007174”, “000000007178”, “000000007179”, “000000006508”, “000000006509”, “000000007209”, “000000007210”, “2KBIM”, “10KBIM”)

Is there a way to do this?

[Required(ErrorMessage = "Please add Product Code to the request.")]
[MaxLength(15, ErrorMessage = "The product code can not be more than 15 characters")]
public string productCode { get; set; }

Hi, I’ve changed your thread title to describe your problem more clearly. Descriptive titles, such as “Why does my function return undefined?”, are more likely to elicit helpful responses than generic titles, such as “Help please”.