代码之家  ›  专栏  ›  技术社区  ›  Barbaros Alp

当我将它声明为参数时,它不起作用吗?

  •  1
  • Barbaros Alp  · 技术社区  · 16 年前

    [AcceptVerbs(HttpVerbs.Post)]
            public ActionResult Create([Bind(Exclude="ID")]int ServiceId, Event evnt)
            {
                var service = dbSrc.GetAll().WithID(ServiceId).SingleOrDefault();
                if (service == null)
    

    [Bind(Exclude = "ID")]
        partial class Event
        {
    

    提前谢谢

    1 回复  |  直到 16 年前
        1
  •  6
  •   Craig Stuntz    16 年前

    这个怎么样:

    public ActionResult Create(int ServiceId, [Bind(Exclude="ID")]Event evnt)
    

    相反我打赌 ServiceId 没有 ID