I\'m trying to do something different. I have a view that contains an Id. Based on the value of the Id I want to change my heading that appears. Something like:
This doesn't answer your question, as indicated by the question's title, but it does solve the problem you described in the body of the question.
Use a view model class as the view's model and add a method that includes the switch
statement. Then just call the method from the view via @Model.MethodWithSwitchStatement()
. [The id
can be saved in the view model object.]