title: Calculating sum of URL parameters (numbers) using function from dll file
body: <p>I have created a dll file that does an addition function. Right now, i am creating an ASP.NET API, which is suppose to carry out addition, using the function created in the dll. I want it such that when i run the ASP.NET API, user inputs the two numbers that they want to add in the URL as parameters e.g. <code>https://localhost:12345/api/addition/9/6</code> and there will be an output data something like (in JSON) {The first number is: 9, The second number is:6, The sum is: 15}. </p>
  
  <p>I have set the parameters so that user can input the numbers. I have created a class to call the dll. However, i am not sure on what i should put in the controller class, how to make it such that the numbers that the user inputs will be calculated using the function from the dll and how to display the output.</p>
  
  <p><strong>Here are my codes:</strong></p>
  
  <p><strong>Addition.cs</strong></p>
  
  <pre><code>namespace NewAdditionAPI.Models
  {
    using ClassLibraryDll;
    public class Addition
    {
      static int num1;
      static int num2;
      int sum = MathClass.Add(num1, num2);
    }
  
  public string addition (int num1, int num2)
    {
      //What do i have to code here
    }
  }
  </code></pre>
  
  <p><strong>DllAdditionController.cs</strong></p>
  
  <pre><code>public class Temp
  {
      public string num1 { get; set; }
      public string num2 { get; set; }
      public string sum { get; set; }
  }
  
  public class DllAdditionController : ApiController
  {
      private Addition addition = new Addition();
  
      public string GET(int num1, int num2)
      {
          //What do i have to code here
      }
  }
  </code></pre>
  
  <p><strong>WebApiConfig.cs</strong></p>
  
  <pre><code>public static void Register(HttpConfiguration config)
  {
          // Web API configuration and services
          // Web API routes
          config.MapHttpAttributeRoutes();
  
          config.Routes.MapHttpRoute(
              name: "DllAdditionApi",
              routeTemplate: "api/dlladdition/{num1}/{num2}",
              defaults: new { action = "Get", controller = "DllAddition" }
          );
  }
  </code></pre>
  
  <p><strong>dll file</strong></p>
  
  <pre><code>public static class MathClass
  {
      //method for Addition
      public static int Add(int num1, int num2)
      {
          return num1 + num2;
      }
  }
  </code></pre>
  
  <p>Someone please help me. Thank you so much in advance.</p>