- using System.web.Mvc;
- namespace MvcApplication1.Controllers
- {
- public class ProductsController : Controller
- {
- public ActionResult Index()
- {
- return View();
- }
- public ActionResult Details(int id)
- {
- if (!id.HasValue)
- return RedirectToAction(“Index”);
- //return View();
- }
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/040920135596.html
来源: http://www.codesnippet.cn/detail/040920135596.html