两者都与动作方法相同,您可以单独或一起使用它们。
[NonAction]
private ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
FEED_TBL fEED_TBL = db.FEED_TBL.Find(id);
if (fEED_TBL == null)
{
return HttpNotFound();
}
return View(fEED_TBL);
}
如果像上面的代码一样声明它,那么当我们尝试转到详细信息操作方法时,它不会转到它。而是会显示错误。
{{ HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.}}
这表明我们在视图上的详细信息链接确实找到了对详细信息操作方法和我们的控制器的任何引用。