asp.net - ASP dot net core -


i'd know how specify routes in dot net core. example, have method, gets 1 argument(id), , returns user. method available through link (api/user/1). so, question how make method link -"api/user/1/profile" id , returns relevant id. necessary make 2 methods, or separate them , specify routes?

using attribute based routing, can done this.

[httpget("{id:int}")] public async task<iactionresult> getuserbyid(int id) {}  [httpget("{id:int}/profile")] public async task<iactionresult> getuserprofilebyid(int id) {} 

more information on routing can found @ link.

https://docs.asp.net/en/latest/fundamentals/routing.html


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -