Objective
This tutorial will explain the basics of using Microsoft's Visual Studio Express 2012 or Visual Web Developer Express Service Pack to build an ASP. NET MVC4 Web application 。 It is recommended that you use Visual Studio 2012 and you will no longer need to install any components to complete this tutorial. If you are using Visual Studio 2010, you must install the following components. You can install all of the required components by clicking on the link below:
- Visual Studio Web Developer Express SP1 Prerequisites
- WPI Installer for ASP 4
- LocalDB
- SSDT
If you are using Visual Studio 2010 instead of Visual Web Developer 2010, you need to install WPI Installer for ASP. NET MVC 4 and Visual Studio Prerequisit Es
In this article, the C # sample source code is a Visual Web Developer Project: Download the C # sample source code for this article.
What kind of application will this sample build?
You will implement a simple movie list application that will support the ability to create, edit, search, and select a movie list from the database. Here are two screenshots of the application you will build. It includes a movie list page that displays the selected from database:
The app also allows you to add, edit, and delete movies, as well as display the details of individual records. All user data entry scenarios contain data validation logic to ensure that the data stored in the database is correct.
Entry
Run Visual Studio Express 2012 or Visual Web Developer Express to start this example, most of which use the Visual Studio Express 2012 screen in this series, and you can also use the Visual Studio 2010/sp1,visual Studio 2012,visual Studio Express 2012 or Visual Web Developer Express to learn to complete this tutorial. From the start page, select New Project.
Visual Studio is an IDE integrated development environment. Just as you use Microsoft Word to write documents, you can use the Integrated development environment (IDE) to create an application. A variety of different options are displayed for you to use in one of the top toolbars in Visual Studio. There is also a menu in the IDE that provides another way to perform tasks. (For example, you can not select new Project from the start page, you can use the menu, and then choose file > " new Project ")
Create your first application
You can use Visual Basic or C # as the programming language to create your application. Select Visual C # on the left, and then select the ASP. NET MVC 4 Web application . Name your project "Mvcmovie", and then click OK .
In the new ASP. NET MVC 4 Project dialog box, select Internet Application . Use Razor as the default view engine.
Click OK . The ASP. NET MVC project that Visual Studio has just created uses the default template, so you don't need to do anything in the current project! This is a simple "Hello world!" "Engineering, and this is also a good place for you to start the" Mvcmovie "project.
From the Debug menu, select Start Debugging .
Note that you can also use the keyboard shortcut key F5 to start debugging.
F5 enable Visual Studio to start IIS Express and run the Web application. Visual Studio then launches the browser and opens the application's main page. Note that localhost is displayed in the address bar of the browser instead of an address such as example.com. This is because localhost will always be resolved to your own local computer, in which case this is exactly the application you have just built. When Visual Studio runs a Web project, a Web service that uses a random port is used. In the picture below, the port number is 41788. When you run the application, you may see a different port number.
On the right side of the default template page, you are provided with home, about, and contact pages. It also provides registration and login features, and provides links to Facebook and Twitter. The next step is to modify this default application and learn some knowledge about ASP. Close the browser, let's modify some of the source code.
full document Download: ASP. NET MVC4 Getting Started Guide. pdf
--------------------------------------------------------------------------------------------------------------- --------------------------------
Translator Note:
This series of 9 articles, translated from the official ASP. NET MVC4 tutorial, because this series of articles concise, space moderate, from an example to explain, the full text finally completed a small system to manage the film, very suitable for the novice MVC4 ASP, and start the development work. 9 Articles for:
1. Introduction to ASP. MVC4
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4
· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/11/01/2749906.html
2. Add a Controller
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-controller
· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/11/02/2751015.html
3. Add a View
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-view
· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/11/06/2756711.html
4. Add a model
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model
· Address: http://www.cnblogs.com/powertoolsteam/archive/2012/12/17/2821495.html
5. Accessing the data model from the controller
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/accessing-your-models-data-from-a-controller
· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/01/11/2855935.html
6. Validating editing methods and editing views
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-edit-methods-and-edit-view
· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/01/24/2874622.html
7. Add a new field to the movie table and model
· Original address: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/ Adding-a-new-field-to-the-movie-model-and-table
· Address:http://www.cnblogs.com/powertoolsteam/archive/2013/02/26/2933105.html
8. Adding a validator to the data model
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-validation-to-the-model
· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/03/05/2944030.html
9. Query details and delete records
· Original address: Http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-details-and-delete-methods
· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/03/07/2948000.html
10. Third-party control Studio for ASP. Wijmo MVC4 Tools App
· Address: http://www.cnblogs.com/powertoolsteam/archive/2013/05/09/3068699.html
ASP. MVC4 Getting Started Guide (1): Introduction