安装: 传送门
以下是遇到的一些问题:
1.form表单提交控制器如何获得:
①using Nancy.ModelBinding;
var config = this.Bind<CommonHelp.UserInfo>();
public class UserInfo
{
public string Id { get; set; }
public string username { get; set; }
}
https://github.com/NancyFx/Nancy/wiki/Model%20binding
②var config = SqlHelper.ToDBValue(Request.Form);
2.css样式引用
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
nancyConventions.StaticContentsConventions.Clear();
nancyConventions.StaticContentsConventions.Add
(StaticContentConventionBuilder.AddDirectory("css", "/css"));
nancyConventions.StaticContentsConventions.Add
(StaticContentConventionBuilder.AddDirectory("js", "/script"));
nancyConventions.StaticContentsConventions.Add
(StaticContentConventionBuilder.AddDirectory("images", "/images"));
}
}
<link href="css/main.css" rel="stylesheet" type="text/css" />
http://www.codeproject.com/Articles/694907/Lift-your-Petticoats-with-Nancy
3.datatable传值view
@foreach (var item in Model.product)
{
<div>
<a href="/Detailed?id=@(item.ItemArray[0])" target="_blank">
<img src="@(item.ItemArray[4])" />
<p>@(item.ItemArray[1])</p>
</a>
</div>
}
4.Get["/List/{page}"] = p =>样式没有
<link href="/css/main.css" rel="stylesheet" type="text/css" />