I assume that you are new in MVC Architecture so I start with 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 unnecessary burden of 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 Module, View and Controller. It is new technology for developing web apps over traditional asp.net (.aspx).
Module – It is responsible for maintaining data. When you work with database module 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 Module folder.
- File extension of MVC is .cshtml
- It works in 3 steps
- Controller receives the user inputs and requests
- Then it works with model to prepare data
- And finally View present data to user end.
- 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 html page.
You can learn Complete Razor Syntax Here. It won’t take long time and even you can learn it in an hour. However in the next chapter I will discuss about basic razor syntax that will help you to learn ASP.Net Core MVC easily.
You can find all these folders (Module, View and Controller) in solution explorer.
In the next chapter you will learn about the folder structure of MVC. It is necessary to know about folder structure before proceeding next.