• Nancy学习笔记


    安装: 传送门

    以下是遇到的一些问题:

    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" />

  • 相关阅读:
    题解 [APIO2014]连珠线
    题解 [ZJOI2019]语言
    题解 Hero meet devil
    题解 [BJOI2019]奥术神杖
    题解「2017 山东一轮集训 Day1 / SDWC2018 Day1」Set
    题解 Sue的小球/名次排序问题/方块消除/奥运物流
    题解 「一本通 5.4 练习 1」涂抹果酱
    Mybatis的类型转换
    面试题:微服务熔断降级限流
    面试题:微服务网关
  • 原文地址:https://www.cnblogs.com/margin-gu/p/5015737.html
Copyright © 2020-2023  润新知