我有一个控制器来显示一个模型(用户),并想创建一个只有一个按钮来激活的屏幕。我不想要表单中的字段。我已经在url中有id了。我如何才能做到这一点呢?
发布于 2012-07-19 00:15:14
我的方法不是添加一个未使用的参数,因为这似乎会造成混乱,而且通常是糟糕的做法。相反,我所做的是将"Post“附加到我的操作名称:
public ActionResult UpdateUser(int id)
{
return View();
}
[HttpPost]
public ActionResult UpdateUserPost(int id)
{
// Do work here
RedirectToAction("ViewCustomer", new { customerID : id });
}https://stackoverflow.com/questions/4429066
复制相似问题