Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // örnek: /category/8
- [Route("~/category/{id:int}")]
- public ActionResult Index(int id)
- {
- ViewBag.Title = id;
- return View();
- }
- // örnek /category/NoName
- [Route("~/category/{name}")]
- public ActionResult Index(string name)
- {
- ViewBag.Title = name;
- return View();
- }
- // örnek:/category/5 çalışır
- // örnek:/category/10000000000 çalışmaz çünkü int.MaxValue'den büyük
- // örnek:/category/0 çalışmaz çünkü tanımlanan min(1) değerinden küçük
- [Route("~/category/{id:int:min(1)}")]
- public ActionResult Index(int id)
- {
- ViewBag.Title = id;
- return View();
- }
- // örnek: /category/test çalışır.
- // örnek: /category/bilgisayar çalışmaz.
- // örnek: /category/ çalışır.
- [Route("~/category/{name:maxlength(5)?}")]
- public ActionResult Index(string name)
- {
- ViewBag.Title = name;
- return View();
- }
Add Comment
Please, Sign In to add comment