Make more than one condition annotation asp.net mvc

1

I have my class

and I have a property in it

public TipoPessoa TipoPessoa {get;set;}

The same is an enumerator that has value "Physical and Legal"

And I have a property that is CNPJ or CPF

public string Cpf_Cnpj {get;set;}

How do I make it condition at the time of validating at anotation?

    
asked by anonymous 29.08.2014 / 19:05

1 answer

1

Using a mixed validation attribute. In another answer, I've taught you how to implement an attribute that validates CNPJs . The challenge is to do the same validation for the CPF.

I do not have the CPF code now, but I will edit the question later by putting an example attribute for CPF validation.

    
29.08.2014 / 19:45