What is the best way in ASP.MVC2 to select an image to display in the controller

I play with an ASP.MVC site, I want one of three images to be displayed depending on the enumeration value in the strongly typed model that I had.

I could use the IF / Case statement in the view, but it should be responsible for the controller, which I feel is the best way to implement it?

+3
source share
2 answers

If you have Enumerable<YourModel>, you can point Dictionary<YourEnum, Uri>to the view from the controller.

In this way, the controller can decide what valid images are, etc.

, . , , , WinForms, -.

, Dictionary<YourEnum, string>, . URL-, , .

+2

, . .

+1

Source: https://habr.com/ru/post/1767600/


All Articles