I'm new to MVC (previously using WebForms) and there is one thing I can't seem to find an answer for... Where do you put all the methods that help control the layout?
A lot of the info I've read seems quite contradictory... Most people say you never have any methods inside models or controllers but others say you can? I've also read you shouldn't have methods in a view either. If you can't have methods in Models, Controller or Views then how do you construct any page layout?
It's easy enough to build separate class files with the required methods but then how do you access these in the view?
I understand MVC separates all the concerns but it seems quite difficult to manipulate the view HTML if you only have the model data. The Model usually contains lots of ID and Boolean values which are not for display purposes.
For example I may want to change a specific URL link in the view based on multiple values from the model.
The model may contain values like this:
- Type = "Country"
- ID = 75
I would then build the URL based off these values... previously in WebForms this would have been in the code behind but this now doesn't exist in MVC... so what is the best practice in MVC for this?