[null, null, {"document_url": "http://chandanprogramming.blogspot.com/2013/04/mvc-example-using-razor-engine.html", "unformatted_src": "http://1.bp.blogspot.com/-93d1H46-6yw/UXeIhu7Uo5I/AAAAAAAAaQI/ylFNWg3WlqI/s320/4-24-2013+12-45-41+PM.png", "src": "http://1.bp.blogspot.com/-93d1H46-6yw/UXeIhu7Uo5I/AAAAAAAAaQI/ylFNWg3WlqI/s320/4-24-2013+12-45-41+PM.png", "formatted_filename": "PM", "rendered_width": 320, "rendered_height": 263}, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]

MVC Demo using razor engine

Model : All the operations related to fetching of data is handled here and also application state is maintained.
View: It the User Interface of an application.
Controller: All the web request are first accepted by the controller and also it acts as a intermediate to view and model. Controller decides what action has to be taken for all web requests. Now lets create a sample MVC application:
1. Go to file –> New --> project –> select asp.net MVC 4 web application and click ok.

2. Enter name for your application. Select an Empty Project and then select view engine as razor. uncheck the create unit test project and then click ok.
3. Then after this go to solution explorer. Right click on controller and add controller. The name of the controller should be always anynameController, as in my case its HomeController.
Click on add and the HomeController.cs will get added to the controller folder of the application. 5. Now in models folder add one class file like in my case its Model1.cs and write this below code inside the class. 6. Again going back to the controller , change the namespace to as of models so that we can access properties of model class. Then describe method implementation for method Index(). After this build the application(This is compulsory) . Then Right click on index() and add view. 7. This below window will get appear. The view name should be same as of the name of method index() in the controller. Select View engine as Razor and select create a strongly typed view and from drop-down select model class, then add. 8. In view we will display the empid and empname to the user whose value has been set in index() method inside the controller. As we are using RAZOR engine , @ symbol is used to describe a razor syntax. 9. Now run the application it should the below output as shown below: Posted by chandan singh at 9:35 AM Labels: Beginning MVC, Learn MVC, MVC Example Which is the Best Mobile OS