Reputation: 277
I was wondering what is the best way to convert a boolean value retrieved from the database to text for use in a display-field or textbox (e.g. true or false to Male or Female). Any suggestions?
Upvotes: 0
Views: 328
Reputation: 52280
make the conversion in the view - IMHO this is not against MVC. If you want to go hardcore with your design create a new class/struct "Gender" with static creation methods/properties "Male", "Female", overload the ToString accordingly and cast-operators to bool or a constructor with bool and a ToBool function.
Upvotes: 1