Description
I am using only Attribute Routing in one of my MVC Controllers:
[RoutPrefix("Groups")] // NOTE: I want to use "Groups" with an "s" here.
public class GroupController : Controller
{
[HttpGet]
[Route("Edit/{id}")]
public ActionResult Edit(Guid id)
{
//...
}
[HttpPost]
[Route("Edit")]
public ActionResult Edit(GroupEditViewModel model)
{
// ...
}
}
In the Razor view, whenever using helpers such as:
@Html.ActionLink("Text", "Edit", new {controller = "Groups", id = "someId"})
or
@Html.BeginForm(actionName: "Edit", controllerName: "Groups")
{
}
The routes generated by the helper function are null:
<a href>Text</a>
and
<form action></form>
Question
- Is this happenning because the controller's name is unknown maybe?
- Is there a way I can set the name of the controller with using Only Attribute Routing ?