0

I have those methods, using webapi:

//Responsible for getting or updating a template and it's shifts
public class AdminTemplateDefinitionController : AdminApiController
{
    public HttpResponseMessage Get()
    {
    }

    public HttpResponseMessage Get(int Id)
    {

    }

    public HttpResponseMessage Post([FromBody]ENTemplateDefinitions EnTemplateDefinitions)//add shifts to template 
    {
    }

    public HttpResponseMessage Put([FromBody]ENTemplateDefinitions EnTemplateDefinitions)  //   add skills to template.
    {
    }

    public HttpResponseMessage Delete(ENSkillInTemplate EnSkillInTemplate)// remove skiilId from template
    {
    }
}

For some reason I get this error: Multiple actions were found that match the request.

My RouteConfig is:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );          
}

Any idea ?

Razvan Dumitru
  • 10,549
  • 4
  • 31
  • 50
Guy Z
  • 681
  • 2
  • 7
  • 21
  • 1
    Whats in AdminApiController? – iandayman Jul 06 '15 at 14:33
  • I'm a bit rusty on my MVC but isn't the route looking for id and sending that to the GET request and you're trying to send it Id? – amza Jul 06 '15 at 14:40
  • possible duplicate of [Multiple actions were found that match the request Web API?](http://stackoverflow.com/questions/13291025/multiple-actions-were-found-that-match-the-request-web-api) – CodeCaster Jul 06 '15 at 14:40
  • That was ..sort of...the problem – Guy Z Jul 06 '15 at 14:40
  • AdminApiController inherited from ApiController and had a public method :) I made it private and it's all ok now – Guy Z Jul 06 '15 at 14:44

0 Answers0