一,如下代码
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace WebTestDemo.Controllers { public class TestRouteController : Controller { // GET: TestRoute public ActionResult Index(int id=0) { if (id == 1) { return View("TRounte"); } else if (id == 2) { return View("TRounte"); } else { return View(); } } //public ActionResult TRounte() //{ // return View(); //} } }
二,视图结构
这里我们不需要添加多个action