ASP. net mvc music store tutorial (1): Overview and new projects

Source: Internet
Author: User

From http://firechun.blog.163.com/blog/static/3180452220110270937467/

This article is transferred from http://www.asp.net/mvc, which is organized by the human translation.

Add in January 31: I plan to use MVC in my company's new project.ArticleTranslated as a reference for the company's development team. When I first saw this article, I implemented it with MVC 2, but now I have written a tutorial for MVC 3. I was worried that Microsoft's new products would not always be quite reassuring. In addition, the razor syntax was used in the tutorial, and I didn't want the development team members to delay the development progress because they learned too much new knowledge, this tutorial is originally intended to be implemented using MVC 2. During the translation process, it was found that some of the new features of MVC 3 really don't want to give up, especially the classes and methods not available in MVC 2, so I decided to translate them in the original text. But in the previous five chapters, I implemented them all using MVC 2. It is terrible to write them again ......, Therefore, it can only be modified based on the original translation. Please check the original article ...... If there is a difference, basically the originalCodeI used MVC 2 to rewrite ......

Again Note: From here can download MVC 3 installation package: http://www.microsoft.com/downloads/en/details.aspx? Displaylang = en & familyid = d2928bc1-f48c-4e95-a064-2a455a22c8f6, after installation, if you like the Chinese interface, in the following language options to change to simplified Chinese, download the 1.8m Chinese installation package and then install it again. Be sure to install the 20.9m installation package in English before installing the Chinese package.

 

Overview:

MVC music store is an applicationProgramThis tutorial guides you how to use MVC and Visual Studio for web development. We will start from the most basic point, so even if you only have preliminary Web development experience, it is okay.

We will create a simple music repository that consists of three parts: shopping, review, and management.

Visitors can view records by category

You can view the specified recording and add it to the shopping cart.

You can view your own shopping cart and remove any unwanted items.

During review, a visitor is prompted to log on or register a user account.

 

After creating an account, visitors can enter transportation and payment information to complete the order. To make things easier, we decided to start a surprising promotion: just enter the Promotion Code "free", all for free!

After the order is completed, the visitor can see a simple confirmation page.

On the attached customer-oriented page, we create a management unit to display the records list so that administrators can create, edit, and delete records.

Tutorial: use free Visual Web Developer 2010 Express (Note: Use vs2010 + ASP. net MVC 3 patch package can also) create a new ASP. net MVC 3, and gradually add features to create a complete function of the application. Including database access, form submission, data verification, use of master pages to save the overall style of the website, use Ajax for page refresh and verification, user login, and so on.

You can follow us step by step, you can also download the complete code from here: http://mvcmusicstore.codeplex.com

Note: Visual Web Developer 2010 Express is used in the original article and the MVC 3 project is created (MVC 2 when I read this article last time ......), I used the Chinese versions of MVC 2 and vs2010 to download images not from the original website, but from my own development interface.

1. File-> new project

Choose "new"> "project" from the File menu in vs2010 to go to the "new project" dialog box.

Select "Visual C #-> Web", select "ASP. net mvc 3 empty web application", name the project "mvcmusicstore", and click "OK. This will display the second dialog box. Let's determine some settings of the MVC project. Select the "null" template and set the view engine to razor. Click the "OK" button:

In Solution Explorer, we can see our new project.

"ASP. net mvc 2 empty web application" is not completely empty-It creates a basic directory structure:

ASP. net mvc uses a naming convention to name folders

Folder Function
/Controllers Controllers processes input from the browser, determines what to do, and returns the result to the user
/Views Views includes a UI Template
/Models Models contains data and operations on Data
/Content Including images, CSS, and other static content
/Script Contains JavaScript files
/Add_data Contains database files (Note: It is usually used to save database files released along with the website, such as SQL express database and Access Database configured for the website. You can ignore SQL Server, MySQL, and other databases)

That is, it is an "empty" ASP. net MVC applications also contain these folders, because ASP. net MVC framework tends to "convention is better than configuration" and constructs some default settings based on folder naming conventions. For example, by default, the Controller looks for a view in the Views folder, instead of specifying it in the code generation. By default, you can reduce the amount of code and make it easier for other developers to understand your project. We will use these conventions more in applications.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.