c# - WebAPI route configuration for multiple HttpPost's with different actions -
c# - WebAPI route configuration for multiple HttpPost's with different actions -
i not trying rest. want this:
public class myv2controller { [httppost] public task<usermodel> action1([frombody] firstmodel firstmodel) { } [httppost] public task<usermodel> action2([frombody] secondmodel secondmodel) { } }
the routes should line this:
http://localhost:1234/api/v2/my/action1/ http://localhost:1234/api/v2/my/action2/
i have tried many different route configurations (including various combinations of attribute routing), nil seems work. how might create work?
using route attribute [routeprefix("api/v2/my")] public class myv2controller { [httppost] [route("action1")] public task<usermodel> action1([frombody] firstmodel firstmodel) { } [httppost] [route("action2")] public task<usermodel> action2([frombody] secondmodel secondmodel) { } }
c# asp.net-web-api
Comments
Post a Comment