August 2018
Intermediate to advanced
298 pages
5h 33m
English
Scenario
You're tasked to define two actions with the same name with different verbs such as POST and GET. How will you do it so that you're more RESTful with the controllers?
Aim
Define two actions having the same names with different verbs, such as POST and GET.
Steps for completion
Use the following code:
[Route("Home")]public class HomeController : Controller{ // GET: /<controller>/ [HttpGet()] public IActionResult Index() { return Content("Index action method"); } [HttpGet("Index3")] public IActionResult Index2() { return Content("Index2 action method"); } [HttpPost("Index3")] public IActionResult Index2_Post() { return ...Read now
Unlock full access