I have a model ProductModel which has: * bool IsNew property * ProductDetailsModel Details property
public class ProductModel
{
public bool IsNew { get; set; }
public ProductDetails Details { get; set; }
}
public class ProductDetails
{
public string Code { get; set; }
public string Type { get; set; }
public string Description { get; set; }
public int Number { get; set; }
}
ProductDetails has some other properties eg. Code, Type, Description, Number
I would like to make Description and Number property of ProductDetailsModel required only if IsNew of ProductModel is set to true.
How to do it?
BTW I have more properties of custom types within ProductModel and I can't move their properties into single ProductModel.