I would recommend putting it into a class of its own. For the sake of SRP, your UserModel should do things with a User and only a User. Your UserModel class should not be responsible for generating passwords for new users. Separate it into its own class and call a method on that class during the creation of your new user in your UserModel.
ASP.NET MVC - where should my function put? Controller? Model?
-
24-06-2022 - |
Frage
For example, I have a password generator in my user registration website. Where should I put the function of generating password? Put together with UserController?
What is the correct way to put these functions?
Lösung
Andere Tipps
I would put it in my User Model.
Or you could create a Utility class and put it in there.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow