title: ASP.net Web API 2 custom methods
body: <p>I've added this method to my web api controller:</p>
  
  <pre><code>    [HttpPost]
      public bool CreateTrening(int routineId)
      {
          try
          {
              var userId = User.Identity.GetUserId();
              TreningService.CheckIfLastTrenigWasCompleted(userId);
              TreningService.CreateTreningForUser(userId, routineId);
              return true;
          }
          catch (Exception ex)
          {
              return false;
          }
      }
  </code></pre>
  
  <p>And I've added another route to my WebApiConfig file, so it looks like this now:</p>
  
  <pre><code>       config.MapHttpAttributeRoutes();
  
          config.Routes.MapHttpRoute(
             name: "CustomApi",
             routeTemplate: "{controller}/{action}/{id}",
             defaults: new { id = RouteParameter.Optional }
         );
  
          config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
  </code></pre>
  
  <p>But when I try to call my method:</p>
  
  <p>/EditWorkout/CreateTrening/1</p>
  
  <p>I get this error:</p>
  
  <p>{"Message":"No HTTP resource was found that matches the request URI '/EditWorkout/CreateTrening/1'.","MessageDetail":"No action was found on the controller 'EditWorkout' that matches the request."}</p>
  
  <p>How can I call my method which is in WebApi controller ?</p>