0

Following this answer, regarding the problem of decoupling the model and the controller, I can see a DTO (Data Transfer Object) isn't used anymore.

My question is, how do you handle that if you want to transfer only a part of the model, and not all the model state? (for example, you only want to transfer a field if the remote user is an admin).

Of course, one solution would be to transfer all the state, and let the controller handle which fields the view will finally render according to certain conditions, but is this a good MVC practice?

Thank you in advance!

Community
  • 1
  • 1
Alex
  • 327
  • 1
  • 3
  • 12
  • I'd say yes, just use the rendered-attribute in the view – Jaqen H'ghar Feb 18 '15 at 07:04
  • So, the model serving an attribute, although the current user is not allowed to view it, and the controller not letting the user to view that attribute? – Alex Feb 18 '15 at 08:15

0 Answers0