Good day. I am a novice programmer, so there may be stupid questions.
I am doing a project on ASP.MVC, a question arises related to the architecture of the project.
I have a ViewModel class, which contains the data with which the controller will work and which will be displayed on the Internet page. There is a ViewModelBuilder class that converts a database object to a ViewModel and vice versa.
I need to accept the string entered by the user, process it, extract the missing data from the Internet and form the ViewModel.
The question arose in which class to write the methods that process the input data (this is not validation), pull the missing data into their networks and form the ViewModel.
I have 3 options:
- To controller
- In ViewModel
- In a separate extension class to the ViewModel.
I don’t like the idea of a controller, since these methods are still nothing to do with BusinessLayer and in the controller.
ViewModel for some reason also do not want to load these methods. It seems that they will look logical in this class, but for some reason at the level of intuition, I don’t like this idea.
I am afraid to bring them to the extension class for performance.
Question: where is it correct from the point of view of architecture and following the principles of MVC to place the methods that process the string entered by the user, convert it, pull data out of the network and convert it to write to the ViewModel properties.
