lundi 6 avril 2015

mvc web api parameter attribute processing

I would like to be able to add a filter to my WebApi controller that would allow me to format incoming objects based on Attributes I have placed on properties in the inbound class. The products we created to consume the web api are doing the formatting but we want to make sure that any objects coming in get the formatting. An example would be a person object that has a ZipCode property with a value of 123459876 I would want to identify it by a [ZipCodeFormat] Attribute and format to 12345-9876 using some logic or regex. Any suggestion?





Aucun commentaire:

Enregistrer un commentaire