自由にURLをマッピングする仕様その2
以下の仕様にしようかと思います。
■2.URIをデフォルトから変更する(@Url)
@Url("view") public ActionResult show() {
■3.正規表現によるUriからパラメータの変換(@Url(regex="",param={}))
@Url(regex="/([a-zA-Z0-9]+)/todo/([a-zA-Z0-9]+)", param={"userId","todoId"}) public ActionResult show() {
■4.POSTアクセスサポート(@Url(method=POST))
@Url(regex="/([a-zA-Z0-9]+)/todo/([a-zA-Z0-9]+)/edit", param={"userId","todoId"}, method=GET)//GETは省略可 public ActionResult edit() { @Url(regex="/([a-zA-Z0-9]+)/todo/([a-zA-Z0-9]+)/edit", param={"userId","todoId"}, method=POST) public ActionResult editsave() { }
POSTは、@Urlのmethodで指定、メソッド名はGETから適当に変更します。