内容
概观
1。 “文件” - >“新建项目”
安装软件
创建一个新的 ASP.NET MVC 3 项目.......................................... ................................................. 11
2。控制器.......................................... ....................................... ................................................... 15
添加的 HomeController .................................... ........................ ................................................. 15
运行应用程序.......................................... .......... .................. ......................................................... 17
添加 StoreController.......................................... ....... ............................................................ 19
3。视图和.......................................... ..................... .. .............................................................. 24
添加视图模板.......................................... ................ ................................................... 24
使用常见的网站元素的布局................................... ......................... ................................................. 27
更新样式表.......................................... ................. .................. .................................................. 29
使用模型将信息传递给我们的............................... ............................. ................................................. 31
添加页面之间的相关链接.......................................... ................................................. 41
4。数据访问.......................................... ............ ....................................................... 44
数据库访问与实体框架代码优先.......................................... ................................................. 44
我们的模型类................................... ............ ....................................................... 44
添加 App_Data 文件夹................................... ............ ....................................................... 45
创建连接字符串在 web.config 文件中........................................ ................................................ 46
添加上下文类................................... ............ ....................................................... 46
添加我们的存储目录数据................................... ............ ....................................................... 47
查询数据库................................... ............ ....................................................... 48
更新存储索引在数据库中查询.......................................... .................................................. 49
更新商店浏览和详细使用实时数据......................................... .............................................. 49
5。编辑表格的使用脚手架................................... ............ ....................................................... 54
创建 StoreManagerController................................... ............ ....................................................... 54
修改脚手架浏览的................................... ............ ......................... ...................................... 55
先看看在商店经理................................... ............ .................. ............................................. 57
MVC 音乐商店教程 V3.0B(MVC 3 工具更新发布) - http://mvcmusicstore.codeplex.com
根据知识共享署名 3.0 许可教程
第 2 页
寻找在的商店经理控制器代码........................................... .................................................. ...... 61
商店经理人指数和详细行动.......................................... .................................................. ....62
“创建行动计划” .......................................... .................................................. .... 62
将信息传递到一个视图中使用.......................................... .................................................. ....62
创建视图的下拉菜单中显示的 HTML 助手....................................... ................................. 63
处理提交的表单值.......................................... .................................................. ....64
处理编辑.......................................... .................................................. ....66
处理删除.......................................... .................................................. ....68
使用自定义的 HTML Helper 来截断文本.......................................... .................................................. .... 72
6。用数据注解模型验证............................................ .................................................. ...... 76
我们的 Album 表格中添加验证.......................................... .................................................. ....76