1 @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic> 2 @{ ; ; 5 } > 7 <h1>NancyDemo</h1> >Nancy is a lightweight, low-ceremony, framework for building HTTP based services on .NET and Mono. The goal of the framework is to stay out of the way as much as possible and provide a super-duper-happy-path to all interactions.</p> =>Learn more »</a></p> 10 </div>
Index.cshtml
1 @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic> 2 @{ ; ; 5 } 6 <h2>@ViewBag.Title.</h2> 7 <p>Use this area to provide additional information.</p>
About.cshtml
1 @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic> 2 @{ ; ; 5 } 6 <h2>@ViewBag.Title.</h2> 7 8 <address> 9 One Microsoft Way<br /> 10 Redmond, WA 98052-6399<br /> >P:</abbr> </address> 14 15 <address> >Support@example.com</a><br /> >Marketing@example.com</a> 18 </address>
Contact.cshtml然后F5,跑一下
已经能跑起来了。
下面就是结合数据库了。
八、在Models下面建两个类
Movie 2 { MovieId { get; set; } MovieName { get; set; } MovieTypeId { get; set; } DateTime MovieAddTime { get; set; } MovieType MovieType { get; set; } Movie() 14 { 15 MovieAddTime = DateTime.Now; 16 } 17 }
Movie.cs
MovieType 2 { 3 public MovieType() 4 { 5 Movies = new HashSet<Movie>(); 6 } TypeId { get; set; } TypeName { get; set; } ICollection<Movie> Movies { get; set; } 14 }
MovieType.cs以Movie表为例,继续下面的工作。
九、由于movie表中的数据展示,抽取出应该有的视图模型
在ViewModels文件夹下面建立MovieViewModel.cs、MovieListViewModel.cs