2
I have the following structure corresponding to a table in my database:
Cat_Codigo,
Cat_Descricao,
Cat_Observacao,
Cat_Status
Where the Cat_Status
is defined by 0 or 1, with 0 -> Deactivative and 1 -> Active.
However I do not want to display to the final user, 0 or 1, but rather Target and Active, I know that this is possible to be done 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 define that.
Now how do I do the same thing through the Entity Framework? What method can I use to change fields to a name.
In my class the status attribute is as int
, That would cause some trouble too?
Thanks, I managed to solve my problem with your information. well, I have another question related to Entity framework, can I ask you a question here or should I create a new topic?
– Bruno Aparecido da Silva
Give a search on existing questions. If you do not find the answer you can ask a new question (topic). The correct term here is question as it is not forum.
– user26552