I have two Wep APIs. I have done CRUD operation using one eg. Customer. But when I built another Similar Web API and called a method It shows:
{,…} Message: "No HTTP resource was found that matches the request URI http://localhost:23995/Product/Insert'."
MessageDetail: "No route providing a controller name was found to match request URI '[[same link as above here]]'"
Here is my JS Calling Method:
$scope.Insert = function () {
$http({
method: 'post',
url: 'http://localhost:23995/Product/Insert',
data: JSON.stringify($scope.Product)
}).then(function (response) {
alert("chec");
});
}
In Product Controller
// Insert
[HttpPost]
[Route("{controller}/Insert")]
public string Insert([FromBody] Product newProd) {
newProd.Insert();
return newProd.DbResponse;
}
In supplier Controller
// Insert
[HttpPost]
[Route("{controller}/Insert")]
public string Insert([FromBody] Product newProd) {
newProd.Insert();
return newProd.DbResponse;
}