我想将id传递给我的actionresult方法删除
public ActionResult Delete(Guid AssetTypeId)
{
// _repo.DeleteAssetType(AssetTypeId);
if (_repo.DeleteAssetType(AssetTypeId) == 1)
{
return Index();
}
else
{
TempData["AlertMessage"] = "The DELETE statement conflicted with the REFERENCE constraint ";
return Index();
}
.Action("Delete", "AssetType",new { AssetTypeId = "#=AssetTypeId#" }))
答案 0 :(得分:0)
我猜您在架构中声明了AssetTypeId。在这种情况下,您无需单独发送。您只需要在删除中捕获模型。删除它应如下所示;您可以在here的官方演示网站上查看详细信息。
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditingPopup_Destroy([DataSourceRequest] DataSourceRequest request, ProductViewModel product)
{
if (product != null)
{
productService.Destroy(product);
}
return Json(new[] { product }.ToDataSourceResult(request, ModelState));
}