我有一个显示模型的视图,例如:
public class MyModel()
{
public string name {get;set;}
public IList<Note> notes {get;set;}
}
该视图显示模型的所有注释,我正在尝试使用 Ajax.ActionLink 删除注释,但为了删除注释,我需要将我的控制器操作结果传递给模型的 ID。
public ActionResult DeleteNote(int modelId, int noteId)
{
var franchise = _franchiseRepository.FindById(modelId);
Note note = new Note(noteId);
franchise.RemoveNote(note);
_franchiseRepository.SaveOrUpdate(franchise);
return View();
}
Ajax.ActionLink("Delete", "DeleteNote", new {id=item.id}, new AjaxOptions{HttpMethod="POST"})
这可以通过 ajax.actionlink 来完成吗?
提前致谢