Last active
March 11, 2025 20:05
-
-
Save YurePereira/f7301d141e3c41526b72c9af882fdfae to your computer and use it in GitHub Desktop.
Exemplo da utilização de rotas nomeadas com C# e Razor
This file contains hidden or 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
<a asp-route="HomeRota">Home</a> | |
<a asp-route="DoacaoRota">Doações</a> | |
<a asp-route="ContatoRota">Fale Conosco</a> |
This file contains hidden or 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; | |
[Route("my-pet")] | |
public class MyPetController : Controller | |
{ | |
[HttpGet("home", Name = "HomeRota")] | |
public IActionResult Index() | |
{ | |
return View(); | |
} | |
[HttpGet("doacoes", Name = "DoacaoRota")] | |
public IActionResult Index() | |
{ | |
return View(); | |
} | |
[HttpGet("fale-conosco", Name = "ContatoRota")] | |
public IActionResult Index() | |
{ | |
return View(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment