c# - How to give a call to more than two Get method using mvc4 web api controller -


i'm working on mvc4 web api project.

i have created new controller groupvaluescontroller , have following methods

public groupviewmodel get() public list<groupmodel> get(guid id) public list<groupmodel> getdetails(guid id) 

first 2 methods working fine i'm calling them group.cshtml view following

            $.getjson(                 "api/groupvalues",                 function (data) { 

and

$.getjson(                 "api/groupvalues/" + id,                 function (data) { 

for third controller method public list<groupmodel> getdetails(guid id) i'm executing details.cshtml view following not working. i'm mismatching calling ?

 function getgroupdatabyid(id, ctrl) {         $.getjson(                 "api/groupvalues/getdetails/" + id,                 function (data) { 

is related route?

 public static void register(httpconfiguration config)         {             config.routes.maphttproute(                 name: "defaultapi",                 routetemplate: "api/{controller}/{id}",                 defaults: new { id = routeparameter.optional }             ); 

it doesn't matter write after get, going call first 1 same arguments. web api don't rely on name rather rely on http verbs.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -