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.
Comments
Post a Comment