自己做的一个实验,留作备忘,此实例包括扩一下几个文件: 1.MyMovieController.cs 2.Index.aspx 3.ViewUserControl1.ascx 4.movie类 其中MyMovieController.cs不用再说了,代码如下 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.
在上一篇文章中我们已经创建了实体类,在这一篇文章中,我将创建一个新的控制器类——BookController,使用BookController对Books表中的数据进行CURD操作的方法,并使用视图模板在浏览器中显示所查询到的书籍数据信息. 一.添加控制器类 在Visual Studio 的“解决方案资源管理器”中右键单击Controllers文件夹,并创建一个新的BookController控制器类.如下图. Visual Studio 会弹出一个“添加控制器”对话框(如下图). 在对话框中填
准备 在Models文件夹里面新添加Student实体类,用来模拟从Controller向View传递数据,Student类定义如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MVCStudyDemo.Models { public class Student { public int ID { get; set; } public string
菜单表 namespace AspNetMvcAuthDemo1.Models { public class PermissionItem { public int ID { set; get; } public int PermissionID { set; get; } public string Name { set; get; } public string Route { set; get; } } } 菜单表集合 namespace AspNetMvcAuthDemo1.Models