2017-10-03 4 views
1

Ich muss eine Aktionsmethode schreiben, die auf sowohl HTTP Get und Http Post Verben in asp.net Kern MVC reagieren sollte. Ich versuchte Folgendes, aber es hat nicht funktioniert und tatsächlich das Acceptverbs Attribut nicht akzeptiere HttpVerbs.Get | HttpVerbs.Post) wie es in MVC 5 tun würde. Kann mir also jemand helfen?AcceptVerbsAttribute in asp.net Kern

[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)] 
public IActionResult BatchGroupDetails(int id) 
{ 
} 

Antwort

0

Haben Sie diesen Weg versucht? Für mich geht das.

[HttpPost()] 
[HttpGet()] 
public IActionResult Index() 
{ 
    ... 
}