我收到有关我的函数不明确的错误
在以下操作方法之间,当前对控制器类型“ ProductController”的操作“索引”的请求是模棱两可的:类型为bconn.ui.Controllers的System.Web.Mvc.ActionResult Index(bconn.ui.Models.Vm,Int32,Int32)类型bconn.ui.Controllers.ProductController上的.ProductController System.Web.Mvc.ActionResult索引(System.String,System.String)
如您所见,一个控制器具有以下签名
public ActionResult Index(Vm model, int startIndex, int pageSize)
和另一个
public ActionResult Index(string selected, string nothing)
由于存在具有int
不可为空的值的事实,所以我看不出这里有什么歧义?
这不像普通班。当您拥有操作方法时,除非使用[HttpGet]
和[HttpPost]
属性来区分它们,否则您将无法重载它们。
例如,您需要具备:
[HttpGet]
public ActionResult Index(Vm model, int startIndex, int pageSize)
{
...
}
和
[HttpPost]
public ActionResult Index(string selected, string nothing)
{
...
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句