Stackoverflow is built on MVC and does a bunch of simple but nice things with dates and numbers (answer counts, votes, etc...). I'm assuming this is all done with a couple of static helper classes.
My question is should the view call these helper objects or should the controller call these helper objects and embed the result into the ViewData?
Controller Populates View Data
- Controller Loads Model/Data
- Controller uses DateHelper static method to convert date to friendly string
- Friendly date string is provided to view via ViewData
Controller Populates View Data with Model and View calls DateHelper
- Controller Loads Model/Data
- Controller provides model to view via ViewData
- When ViewData is binding to HTML it calls DateHelper static method
I suspect number 1 is the right way to go, but it seems a bit messy in that you can take a List of models and those are easy to loop over in the View. If you process and generate a bunch of friendly strings based on a set of model instances and the model doesn't have a place for those to be attached to a specific instance you end up sending two different lists of data to ViewData. Right?
Your thoughts are appreciated.