1 public class HomeModule : NancyModule 2 { 3 public HomeModule() : base("/admin") 4 { 5 Get["/"] = _ => 6 { 7 return View["index"]; 8 }; 9 } 10 }
1 public class HomeModule : NancyModule 2 { 3 public HomeModule() : base("/other") 4 { 5 Get["/"] = _ => { return View["index"]; }; 6 } 7 }
1 public class HomeModule : NancyModule 2 { 3 public HomeModule() 4 { 5 Get["/"] = _ => 6 { 7 return View["index"]; 8 }; 9 } 10 }
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title></title> 5 <meta charset="utf-8" /> 6 </head> 7 <body> 8 Admin->Home->Index 9 </body> 10 </html>
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title></title> 5 <meta charset="utf-8" /> 6 </head> 7 <body> 8 Other->Home->Index 9 </body> 10 </html>
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title></title> 5 <meta charset="utf-8" /> 6 </head> 7 <body> 8 Home -> Index 9 </body> 10 </html>
1 <div>首部</div>
1 <div>尾部</div>
1 @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic> 2 <!DOCTYPE html> 3 4 <html> 5 <head> 6 <meta name="viewport" content="width=device-width" /> 7 <title>@ViewBag.Title</title> 8 </head> 9 <body> 10 @Html.Partial("/Partials/_PartialHeader") 11 <div> 12 @RenderBody() 13 </div> 14 @Html.Partial("/Partials/_PartialFooter") 15 </body> 16 </html>
1 @{ 2 Layout = "Views/_Layout.cshtml"; 3 } 4 5 内容
1 <span>@Model</span>
1 @Html.Partial("/Partials/_PartialTime", Model)
1 Get["/"] = _ => 2 { 3 var model = DateTime.Now.ToString(); 4 return View["index2",model]; 5 };