1
I’m working with areas
but it’s not working the route and I created 2 areas
, inside a created a folder called Cadastros
and inside the other a folder called Tabelas
.
Cadastrosarearegistration.Cs
namespace Projeto01.Areas.Cadastros
{
public class CadastrosAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Cadastros";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Cadastros_default",
"Cadastros/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
}
}
Tabelasarearegistration.Cs
namespace Projeto01.Areas.Tabelas
{
public class TabelasAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Tabelas";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Tabelas_default",
"Tabelas/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
}
}
My doubt is, when accessing the system, I can access the controllers of the Register, however when clicking on Products of Area Tables, the URL tries to call the same with the Area Registrations, not changing to Tables, Someone can help me?
Layout with the application menu that calls the views
<ul class="nav nav-pills nav-stacked">
<li id="liHome" role="presentation" class="active"><a href="#">Home</a></li>
<li id="liCategorias" role="presentation">@Html.ActionLink("Categorias", "Index", "Categorias")</li>
<li id="liFabricantes" role="presentation">@Html.ActionLink("Fabricantes", "Index", "Fabricantes")</li>
<li id="liProdutos" role="presentation">@Html.ActionLink("Produtos", "Index", "Produtos")</li>
</ul>
Friend, have you tried something like? Html.Actionlink("Link Text", "Actionname", "Controllername", new { Area = "Nomerea" }, new{})
– mcamara
Opa was very slow but at least it worked kkkkk thanks
– Desalex