I'm trying to build simple web api using .net core for doing basic calculations like addition, subtraction, multiplication and division. I created controller class with multiple GET methods. controller class code as shown below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace WebApplication2.Controllers
{
[Route("api/[controller]")]
public class OwnerController : Controller
{
[HttpGet]
public int Add(int value1, int value2)
{
return value1 + value2;
}
[HttpGet]
public int Substract(int value1, int value2)
{
return value1 - value2;
}
[HttpGet]
public int Multiply(int value1, int value2)
{
return value1 * value2;
}
[HttpGet]
public int Divide(int value1, int value2)
{
return value1 / value2;
}
[HttpGet]
public string Get()
{
return "default";
}
}
}
How can I route this controller to do specific action when the respective API are called ?