Moh*_*eza 13 asp.net-mvc http-verbs
我有两个方法,并且由http动词区分:
public class ProductImageController : Controller
{
[HttpGet]
public ViewResult Create(int productId)
{
return View(productId);
}
[HttpPost]
public ViewResult Create(int productId)
{
}
}
Run Code Online (Sandbox Code Playgroud)
但是获取错误:
已经定义了一个名为'Create'的成员,它具有相同的参数类型
Chr*_*s L 25
您不能在同一范围内使用相同签名的多个方法,例如相同的返回类型和参数类型.
编辑 - 看起来你需要使用这个:相关问题
public class ProductImageController : Controller
{
[HttpGet]
public ViewResult Create(int productId)
{
return View(productId);
}
[HttpPost]
[ActionName("Create")]
public ViewResult CreatePost(int productId)
{
//return a View() somewhere in here
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13328 次 |
| 最近记录: |