我可以同时使用以下两个路由规则吗?
config.Routes.MapHttpRoute(
name: "ActionApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional } );
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
控制器说是= FruitApiController:ApiController
,我希望有以下
List<Fruit> Get()
=api/FruitApi/
List<Fruit> GetSeasonalFruits()
=api/FruitApi/GetSeasonalFruit
Fruit GetFruits(string id)
=api/FruitApi/15
Fruit GetFruitsByName(string name)
=api/FruitApi/GetFruitsByName/apple
请帮助我。谢谢