You can use the User class as a model even though you have more information than the view requires. It is a decision you must make during development: when to create a new class as a view model and when to reuse an existing one.
To take this decision, the issues that you will have to consider are:
- Clarity of the code
- If the view needs additional information to the one contained in the class (in this case it would be advisable to create a view model)
- Possible security problems
When I talk about security problems I mean you have to take into account that information received from the browser can include properties that you do not use in the view.
For example, if the User class has the properties Code, Name, Surname, Age, Email. You can create a view in which you only show controls to edit, for example, the first and last name (Name and Surname). However, if a malicious user adds to the information in the post when submitting the form a value with an Email key, MVC will automatically bin this value to the property of the User object received in the controller. You should then take into account in your code that the value of this property could have been modified by the user even if you have not given the possibility to edit it in the form.
If you use a view model class with only the Name and Surname properties this case could not occur.