3
I am trying to implement a standard MVVM (Model - View - Viewmodel) that is related to MVP.
Since Viewmodel, by my understanding, is responsible for "passing" the data from the View layer to the Model, outside the responsibility of doing this intermediation, what I implement most in it?
For example: I have a rule where in the sales form I have a checkbox for Delivery (Yes/No), and if this is marked, enable or show the fields referring to the address, be mandatory and suggest the address of the informed client who is already previously registered in the repository.
Where do I implement this control to enable/show the fields and make them mandatory? What about the question of the suggested address?
In some cases would it not be more feasible to expose the model through Binds and put the validation rules in them? In my view, many validations are also part of the rules of business.
– Renan Cavalieri
This is the default form, by the way. I use this by definition. Only when I need some more specific use behavior Viewmodels.
– Leonel Sanches da Silva