Routing by action name WebApi

Si se quieren utilizar nombres especificos de rutas, en lugar de los estandares REST (get, post, put, delete), cambiar en WebApiConfig.cs:

config.Routes.MapHttpRoute(
          name: "ActionApi",
          routeTemplate: "api/{controller}/{action}/{id}",
          defaults: new { id = RouteParameter.Optional }
);

y comentar el config.Routes existente.


Fuente: https://docs.microsoft.com/en-us/aspnet/web-api/overview/web-api-routing-and-actions/routing-in-aspnet-web-api

No hay comentarios:

Publicar un comentario