Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 显式绑定模型_C#_Asp.net Mvc_Model Binding - Fatal编程技术网

C# 显式绑定模型

C# 显式绑定模型,c#,asp.net-mvc,model-binding,C#,Asp.net Mvc,Model Binding,一般来说,我将使用下面的代码对客户模型进行绑定 [HttpPost] public ActionResult Create(Customer model) { ... } 现在,我想稍后提高绑定,而不是立即,像这样 [HttpPost] public ActionResult Create() { //some operations first ... //binding will start here var model={Bind - To - Customer}

一般来说,我将使用下面的代码对客户模型进行绑定

[HttpPost]
public ActionResult Create(Customer model)
{
  ...
}
现在,我想稍后提高绑定,而不是立即,像这样

[HttpPost]
public ActionResult Create()
{
  //some operations first
  ...
  //binding will start here 
  var model={Bind - To - Customer}
  ...
}
那么,我如何才能做到这一点,这可能吗

非常感谢您提出的任何建议

您可以使用或方法:

[HttpPost]
public ActionResult Create()
{
    //some operations first
    ...
    // binding will start here 
    var model = new Customer();
    UpdateModel(customer);
    ...
}