>Hi everybody,
>
>I am trying to figure out how to construct my URL (and route) in order to be able to pass different parameters.
>
>I have the following class working correctly when called from the menu:
>
>
> [RouteArea("CapacityControl")]
> [RoutePrefix("Max4Sales")]
> [Authentication()]
> public class Max4SalesController : BaseController
> {
> public Max4SalesController(IHttpContextManager httpContextManager)
> : base(httpContextManager)
> {
>
> }
>
> [Route("")]
> public ActionResult Index()
> {
> ViewBag.departmentId = 0;
> ViewBag.categoryId = 0;
> ViewBag.itemId = 0;
> return View();
> }
>
> [Route("Department/{departmentId}")]
> public ActionResult DepartmentById(int departmentId)
> {
> ViewBag.departmentId = departmentId;
> ViewBag.categoryId = 0;
> ViewBag.itemId = 0;
> return View("Index");
> }
>
>The first route is what works correctly. The URL I see in the browser is "http://localhost:5525/CapacityControl/Max4Sales"
>
>I want to somehow be able to call it and pass either departmentId or categoryId or itemId and let it resolve to correct route and logic.
>
>Unfortunately, all variations I've tried in the url line of the browser either resulted in the main route being called (the first one) or in 404 error.
>
>How should I correctly call and create routes for the cases I want?
>
>Thanks a lot in advance.
Based on your route attribute, for the departmentId option you would want to call http://localhost:5525/CapacityControl/Max4Sales/Department/{departmentId}