1
0
mirror of https://github.com/rudollee/LearningMVC.git synced 2026-08-12 00:42:57 +00:00

Ch. 16 Routing Adv (until 16-5)

This commit is contained in:
wook
2017-04-11 00:47:48 +09:00
parent f219a8df27
commit 2fea7ffb5e
9 changed files with 79 additions and 42 deletions
@@ -6,8 +6,10 @@ using System.Web.Mvc;
namespace UrlsAndRoutes.Controllers
{
[RoutePrefix("Users")]
public class CustomerController : Controller
{
[Route("~/Test")]
public ActionResult Index()
{
ViewBag.Controller = "Customer";
@@ -15,6 +17,18 @@ namespace UrlsAndRoutes.Controllers
return View("ActionName");
}
[Route("Add/{user}/{id:int}")]
public string Create(string user, int id)
{
return string.Format("User: {0}, ID: {1}", user, id);
}
[Route("Add/{user}/{password:alpha:length(6)}")]
public string ChangePass(string user, string password)
{
return string.Format("ChangePas Method - User: {0}, Pass: {1}", user, password);
}
public ActionResult List()
{
ViewBag.Controller = "Customer";