Basic Understandings of MVC

I assume that you are new in MVC Architecture so I start with the very beginning of the MVC. After finished last line of this tutorial, you will have sound knowledge of MVC. I am not going to deep dive because it may create an unnecessary burden on you. When you will start working with MVC you will know more about it. So in this chapter, I will cover only basics and necessary statements of MVC.

So, the first Question arises in our mind what is MVC?

MVC stands for Model, View and Controller. It is the new technology for developing web apps over traditional asp.net (.aspx).

Models – It is responsible for maintaining data. When you work with the database, the model will take care of this job.
View – It is complete design part. It is pure HTML design and you can create single pages, master pages or all other pages here.
Controller- It is coding part. All your programming logic will stay here.

In simple words, you have to write programming logic in controller folder, design web pages in View folder and maintain database task in Models folder.

Important notes
  1. File extension of MVC is .cshtml
  2. It works in 3 steps
    1. Controller receives the user inputs and requests
    2. Then it works with model to prepare data
    3. And finally View present data to user end.
  3. You can use Razor Syntax in HTML.

MVC has no any server control, unlike traditional asp.net. You can design your web pages in pure HTML and CSS. Server controls were the biggest drawback because it makes unnecessary server round trips that made page loading slower. In MVC you design page separately and code separately. A new markup language called RAZOR is introduced in MVC that easily embed your coding logic to the HTML page.

You can learn Complete Razor Syntax Here. It won’t take a long time and even you can learn it in an hour. However, in the next chapter, I will discuss basic razor syntax that will help you to learn ASP.Net Core MVC easily.

You can find all these folders (Models, View, and Controller) in solution explorer.

mvcexplorer
In the next chapter, you will learn about the folder structure of MVC. It is necessary to know about folder structure before proceeding next.
 

Share your thought