I need to write an action method which should respond to both Http get and Http post verbs in asp.net core MVC.I tried the following but it did not work and actually the acceptverbs attribute does not accept HttpVerbs.Get | HttpVerbs.Post) as it would do in MVC 5. So can someone help with this?
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public IActionResult BatchGroupDetails(int id)
{
}
Have you tried this way? It works for me.
[HttpPost()]
[HttpGet()]
public IActionResult Index()
{
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With