Adding default values to MvcSample.Web's FiltersController. Otherwise accessing the Actions would return 404 by default.

This commit is contained in:
sornaks 2014-05-13 11:15:39 -07:00
parent 812d5328d2
commit 52c2e41bbb
1 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ namespace MvcSample.Web
[AllowAnonymous] [AllowAnonymous]
[AgeEnhancer] [AgeEnhancer]
[Delay(500)] [Delay(500)]
public ActionResult Index(int age, string userName) public ActionResult Index(int age = 20, string userName = "SampleUser")
{ {
if (!string.IsNullOrEmpty(userName)) if (!string.IsNullOrEmpty(userName))
{ {
@ -38,26 +38,26 @@ namespace MvcSample.Web
return View("MyView", CustomUser); return View("MyView", CustomUser);
} }
public ActionResult Blocked(int age, string userName) public ActionResult Blocked(int age = 20, string userName = "SampleUser")
{ {
return Index(age, userName); return Index(age, userName);
} }
[Authorize("Permission", "CanViewPage")] [Authorize("Permission", "CanViewPage")]
public ActionResult NotGrantedClaim(int age, string userName) public ActionResult NotGrantedClaim(int age = 20, string userName = "SampleUser")
{ {
return Index(age, userName); return Index(age, userName);
} }
[FakeUser] [FakeUser]
[Authorize("Permission", "CanViewPage", "CanViewAnything")] [Authorize("Permission", "CanViewPage", "CanViewAnything")]
public ActionResult AllGranted(int age, string userName) public ActionResult AllGranted(int age = 20, string userName = "SampleUser")
{ {
return Index(age, userName); return Index(age, userName);
} }
[ErrorMessages, AllowAnonymous] [ErrorMessages, AllowAnonymous]
public ActionResult Crash(string message) public ActionResult Crash(string message = "Sample crash message")
{ {
throw new Exception(message); throw new Exception(message);
} }