What kind of logic view model class will have
As the name says view model this class has the gel code or connection code which connects the view and the model.
So the view model class can have following kind of logics:-
Color transformation logic: -For example you have a “Grade” property in model and you would like your UI to display “red” color for high level grade, “yellow” color for low level grade and “green” color of ok grade.
Data format transformation logic :-Your model has a property “Status” with “Married” and “Unmarried” value. In the UI you would like to display it as a checkbox which is checked if “married” and unchecked if “unmarried”.
Aggregation logic: -You have two different Customer and Address model classes and you have view which displays both “Customer” and “Address” data on one go.
Structure downsizing: -You have “Customer” model with “customerCode” and “CustomerName” and you want to display just “CustomerName”. So you can create a wrapper around model and expose the necessary properties.