Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect to Post Method/Action

I have an ActionResult that accepts POST, however is there a work around for me to redirect from a controller to another controller containing this POST method/action???

Here is signature of the method I am redirecting to;

[ValidateAntiForgeryToken]
 [Transaction]
 [AcceptVerbs(HttpVerbs.Post)]
 public ActionResult Edit(Payment payment, PaymentApplication paymentApplication, string exchangeId, bool manual, int firstPaymentId, int? exchangeEventId, bool addOnly)
{

}
like image 771
AppNove Avatar asked Sep 27 '26 13:09

AppNove


1 Answers

You cannot use RedirectToAction to call a POST method. For your specific need, just new the controller and call the method directly from the other controller, passing whatever the parameters.

var controller = new YourControllerWithMethodToCall();
controller.Edit(payment, etc...);
like image 150
Ε Г И І И О Avatar answered Sep 30 '26 02:09

Ε Г И І И О