I have not used asp.net mvc 3 for a while (got side tracked). I can’t remember is it good practice to send back a collection of view models?
Right now how I have my code is I have a view model that contains other view models. This way I only ever send back one view model.
The view models in this one view model could be a collection though. However I have a case where I need to send multiple view models back but that’s all I need to send. I don’t have any other properties or other view models getting sent back.
It seems kinda pointless to wrap it around another view model just to make it only return one view model.
So is it good practice or not?
Thanks
There’s absolutely nothing wrong with that approach. Pass back whatever is necessary to render the View. You can certainly refactor later if you require additional data to be passed to your View.