deleteconfirmed是默认名称吗? [英] Is deleteconfirmed a default name?

查看:120
本文介绍了deleteconfirmed是默认名称吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然不明白为什么该方法从删除转到 DeleteConfirmed

 //获取:/ Movies / Delete / 5 
public ActionResult Delete(int?id)

//
// POST:/ Movies / Delete / 5
[HttpPost,ActionName(Delete)]
public ActionResult DeleteConfirmed(int id)



示例在这里,
我们有

 @ Html.ActionLink(删除,删除,新{id = item.ID})



如果我们将第二个方法名称改为 DeleteConfirmedTest ,它还能正常工作吗?



我有什么试过:



我们没有定义方法名称DeleteConfirmed。

解决方案

删除数据的 HttpPost 方法名为 DeleteConfirmed ,以便为HTTP POST方法提供唯一的信号在这里引用或命名。 





 [HttpPost,ActionName(Delete)] 
public ActionResult DeleteConfirmed(int id)


I still don't understand why the method goes to from Delete to DeleteConfirmed

// GET: /Movies/Delete/5
public ActionResult Delete(int? id)

//
// POST: /Movies/Delete/5
[HttpPost, ActionName("Delete")]
public ActionResult DeleteConfirmed(int id)


The example is here,
We have

@Html.ActionLink("Delete", "Delete", new { id=item.ID })


If we change the second method name as DeleteConfirmedTest, is it still working?

What I have tried:

We don't define the method name DeleteConfirmed.

解决方案

The HttpPost method that deletes the data is named DeleteConfirmed to give the HTTP POST method a unique signature or name here. 



[HttpPost, ActionName("Delete")]
public ActionResult DeleteConfirmed(int id)


这篇关于deleteconfirmed是默认名称吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆