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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user