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

posted @ 2012-03-16 11:38  逍然  阅读(9394)  评论(6编辑  收藏  举报