ASP.NET MVC3官方示例Music Store(音樂商店) --簡易中文教程


前言:

本文來源於微軟MVC3官方教程.在http://mvcmusicstore.codeplex.com/可以下載到最新版本的源碼和英文PDF教程.(文章來自iNxProj.Com)

和英文教程一樣,本文將分成十章節來介紹這個音樂商店的建立.

導航目錄:

  • (一)前期准備,新建MVC項目
  • (二)控制器
  • (三)視圖與模型
  • (四)數據訪問
  • (五)使用腳手架功能創建編輯頁面
  • (六)使用Data Annotation為模型進行驗證
  • (七)成員和權限
  • (八)Ajax刷新效果的購物車
  • (九)注冊和支付
  • (十)最終版本修正與發布

綜述:

原文:The MVC Music Store is a tutorial application that introduces and explains step-by-step how to use ASP.NET MVC and Visual Web Developer for web development. We’ll be starting slowly, so beginner level web development experience is okay.

The application we’ll be building is a simple music store. There are three main parts to the application: shopping, checkout, and administration.

翻譯:MVC音樂商店是一個示例應用程序,它將一步一步介紹和說明如何使用ASP.NET MVC和Visual Web Developer進行Web開發。本教程會慢慢講解,因此,即使你是一名初學者也沒問題。

我們要開發的是一個簡單的音樂商店,主要包括三個主要功能:購物,支付,管理。

 

 

 

原文:Visitors can browse Albums by Genre:

翻譯:訪客可以根據專輯類別瀏覽唱片

 

 

原文:They can view a single album and add it to their cart:

翻譯:可以查看單個唱片並且加入到購物車:

 

 

原文:They can review their cart, removing any items they no longer want:

翻譯:可以查看購物車,並且移除不需要的商品:

 

 

原文:Proceeding to Checkout will prompt them to login or register for a user account.

翻譯:支付訂單的時候會提示用戶注冊或者登陸帳號。

 

 

原文:After creating an account, they can complete the order by filling out shipping and payment information. To keep things simple, we’re running an amazing promotion: everything’s free if they enter promotion code “FREE”!

翻譯:創建一個帳號之后,示例程序采用“免費代碼”支付的方似乎模擬支付過程。(其實這不算翻譯啦)

 

 

原文:After ordering, they see a simple confirmation screen:

翻譯:訂單完成之后會有一個簡單的確認界面:

 

 

In addition to customer-faceing pages, we’ll also build an administrator section that shows a list of albums from which Administrators can Create, Edit, and Delete albums:

除了訪客瀏覽的界面之外,我們還創建了一個后台管理界面,用於管理唱片的增刪查改:

 

 

 

前期准備:

需要的開發工具:

  • Visual Web Developer 2010 Express SP1 或者 Visual Studio 2010 SP1
  • SQL Server Compact 或者 SQL Server
  • Asp.Net MVC3 和 ASP.NET MVC 3 Tools Update
  • 一份MvcMusicStore-Assets的代碼

筆者用的是 Visual Studio 2010 SP1+Sql Server 2008開發的,上文提到的Visual Web Developer 2010 Express和SQL Server Compact都是免費的,大家可以到微軟的官方下載。MVC3這個就是必須的,MVC3中文的安裝方式有點麻煩,之后會獨立一個文章說明一下怎樣安裝,急的朋友也可以Google一下怎樣安裝。筆者之前一直納悶為什么自己的控制器添加界面和官方教程里面的界面有所不同,后來和朋友溝通才發現,原來少裝了一個ASP.NET MVC 3 Tools Update,這個工具可以讓程序員減少編碼,是個好東西。MvcMusicStore-Assets這個在http://mvcmusicstore.codeplex.com下載的壓縮包里面有。

軟件的下載地址:

Visual Studio Web Developer Express SP1 prerequisites

http://www.microsoft.com/web/gallery/install.aspx?appid=VWD2010SP1Pack

ASP.NET MVC 3 Tools Update

http://www.microsoft.com/web/gallery/install.aspx?appid=MVC3

SQL Server Compact 4.0 – including both runtime and tools support

http://www.microsoft.com/web/gallery/install.aspx?appid=SQLCE;SQLCEVSTools_4_0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM