Basics Of MVC Architecture
In this article, you will get a brief idea about the MVC structure. Almost all the language use MVC but with slightly different variations. MVC stands for Model, View, Controller. It’s an architectural pattern that separates an application into three logical components.
The MVC is an architectural pattern that separates an application into three main logical components Model, View, and Controller. All architecture component is made to handle specific development aspects of an application. MVC separates the business logic and presentation layer from one another.
It represents the logic and shape of data. Basically, you can store and retrieve data into the model. It Maintains the data, for example, It stores the data of the student table from the database then sends it to the controller and after doing any operations model send that data to the database. The model is also the class who has the objects and property with the defined get and set methods.
A view represents the user interface of any application. It displays the data using the model to the user and the user can manipulate the data and send them to the controller. Views are the file with .cshtml extension which contains the HTML and server-side code.
Basically controller handles the user requests. The user interacts through view, so the controller handles the request and redirects the request to the view with the model data. A controller is nothing but a class that contains the methods and every method returns a view of type JSON, HTML, XML, etc.
In general, when a user hit particular URL, it goes to routing file and then comes to controller then controller finds the particular actions that match the request and then you can fetch the data from database and store them in the model After that controller redirects the model to the view, so on the view, page user can see the data.