Last active
January 25, 2022 06:17
-
-
Save papeMK2/66c52ee796c676b78d64ef1188a06a49 to your computer and use it in GitHub Desktop.
ASP.NET Core Rooting Demo 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
namespace Rooting.Controllers; | |
public class HomeController : Controller | |
{ | |
private readonly ILogger<HomeController> _logger; | |
public HomeController(ILogger<HomeController> logger) | |
{ | |
_logger = logger; | |
} | |
[Route("/Home/Index")] | |
[Route("/Home/name={param1}/Index")] | |
[Route("/Home/id={param1},name={param2}/index")] | |
public IActionResult Index(string param1, string param2) | |
{ | |
return View(); | |
} | |
// param を愚直にパース | |
[Route("/Home/{param}/Index")] | |
public IActionResult Index(string param) | |
{ | |
return View(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment