I have the following structure corresponding to a table in my Database:
Cat_Codigo,
Cat_Descricao,
Cat_Observacao,
Cat_Status
Where Cat_Status
is defined by 0 or 1, where 0 -> Disabled and 1 - > Active.
But I do not want to display to the end user, 0 or 1, but Disable and Active, I know this is possible through the following SQL command
SELECT cat_codigo As Codigo, cat_descricao As Descricao, cat_observacao AS Observacao,
CASE cat_status WHEN '1' THEN 'Ativo' WHEN '0' THEN 'Desativo' END AS Status FROM Categoria
Using the command CASE
I can set this.
Now how do I do the same thing through the Entity Framework? Which method can I use to change the fields to a name.
In my class the status attribute is as int
, would this cause any problems too?