I need to pass two parameter from typescript with angular.js to Controller. i tried this way but it didn't work. accutually i don't know that the way of i pass this parameters are correct
IncrementDonation(donationId: number, donationAmount: number, successCallback: Function): void {
this.httpService.put("/API/PrivateAPI/MyGivingPortfolio?donationId=" + donationId + "&donationAmount=" + donationAmount).success(function () {
successCallback();
});
}
values of donation Id and donation amount is passed from view.
This is my controller code.
public bool Update(int donationId, decimal donationAmount)
{
// Some Code goes here
}
After changing Controller Code like this it works fine. Thanks.. :D
public bool Put(int donationId, decimal donationAmount)
{
// Some Code goes here
}
Krishan,
I've noticed that you managed to get this working by using a method called Put
. I have to confess (without trying), I cannot see how this will work as you reference a method called MyGivingPortfolio
from your angular code. The method signature should (imho) be (notice i also qualify the http request type as [HttpPut]
):
[HttpPut]
public ActionResult MyGivingPortfolio(int donationId, decimal donationAmount)
{
// Some Code goes here
// return appropriate json back to angular
}
Worth noting this as an alternative, in case you just lucked out with your approach above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.