i have definned a Map route like this:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=User}/{action=Student}/{id?}");
});
and i have an API Action with Attribute routing like this:
[Route("api/User")]
public class UserApiController : Controller
{
....
[HttpGet]
[Route("Teacher")]
public async Task<IEnumerable<UserApiVM>> GetTeachers()
{
....
}
}
Which i can access browsing to a direct url like "http://api/User/Teacher".
Now i whant to generate that url using the @URL.Action helper or any other helper, but i can't figure out how. I tried with
@Url.Action("Teacher","UserApi")
but it couldn't find the controller.
BTW, the controller is Controllers are in a folder called "Controllers", and the API controllers in a folder called "API" inside the "Controllers" folder.
Thanks!