Open ledux opened 10 years ago
I got one Route, which maps three Actions in one API-Controller:
configuration.Routes.MapHttpRoute( name: "kontext", routeTemplate: "pabsapi/leistungserfassung/{maid}/{firmId}", defaults: new { controller = Routing.KONTEXT, maid = RouteParameter.Optional, firmId = RouteParameter.Optional });
The Actions:
[HttpGet] public ILeKontext GetKontext() { string maid = ExtractUsername(); ILeKontext kontext = _repo.GetKontext(maid); return kontext; } [HttpGet] public IPabsMitarbeiter GetMitarbeiter(string maid) { IPabsMitarbeiter mitarbeiter = _repo.GetMitarbeiter(maid); return mitarbeiter; } [HttpGet] public IFirmaRoute GetFirmRoute(string maid, int firmId) { IFirmaRoute route = _repo.GetRoute(maid, firmId); return route; }
Unfortunately MvcRouteTester always maps to the Action GetFirmRoute(maid, firmId)
private static HttpConfiguration _routes = new HttpConfiguration(); ApiRouteConfig.Register(_routes); _routes.ShouldMap("/pabsapi/leistungserfassung").To<KontextController>(HttpMethod.Get, c => c.GetKontext()); _routes.ShouldMap("/pabsapi/leistungserfassung/lt").To<KontextController>(HttpMethod.Get, c => c.GetMitarbeiter("lt")); _routes.ShouldMap("/pabsapi/leistungserfassung/lt/1").To<KontextController>(HttpMethod.Get, c => c.GetFirmRoute("lt", 1));
Only the last ShouldMap passes the test.
If I change every Actionname to Get, everything works fine.
Is there a way, to have different Actionnames in the same route?
I got one Route, which maps three Actions in one API-Controller:
The Actions:
Unfortunately MvcRouteTester always maps to the Action GetFirmRoute(maid, firmId)
Only the last ShouldMap passes the test.
If I change every Actionname to Get, everything works fine.
Is there a way, to have different Actionnames in the same route?