1

パラメータとしてページネーションオブジェクトを持つアクションメソッドがあります

  public override ActionResult Index(Paging paging) 
  {
        .......
        return View(...);
  }

では、アクションメソッドとそのパラメーターに一致するURLを確認するにはどうすればよいですか? 以下のように

Paging paging = new DefaultPaging();
"/Search".ShouldMapTo<SearchController>(action => action.Index(paging));

アップデート

ルート定義は次のようになります。Pag​​e、PageSize、Sort は Paging クラスのメンバーです。

routes.MapRoute(controller.Name, string.Format("{0}/{{Page}}/{{PageSize}}/{{Sort}}", controller.Name),
                       controller.Index().AddRouteValues(new DefaultPaging()));
4

0 に答える 0