> [Route("")] > public ActionResult Index() > { > = CleanIDs(); > return View(); > } > > [Route("Department/{departmentId}")] > public ActionResult DepartmentById(int departmentId) > { > = CleanIDs(); > ViewBag.departmentId = departmentId; > return View("Index"); > } > > [Route("Category/{categoryId}")] > public ActionResult CategoryById(int categoryId) > { > = CleanIDs(); > ViewBag.categoryId = categoryId; > return View("Index"); > } > > [Route("Item/{itemId}")] > public ActionResult ItemById(int itemId) > { > = CleanIDs(); > ViewBag.itemId = itemId; > return View("Index"); > } > > [Route("SubCategory/{subCategoryId}")] > public ActionResult SubCategoryById(int subCategoryId) > { > = CleanIDs(); > ViewBag.subCategoryId = subCategoryId; > return View("Index"); > } > public CleanIDs() > { > ViewBag.departmentId = 0; > ViewBag.categoryId = 0; > ViewBag.itemId = 0; > ViewBag.subCategoryId = 0; > return ; > }>
> [Route("")] > public ActionResult Index() > { > = CleanIDs() > return View(); > } > > [Route("Department/{departmentId}")] > public ActionResult DepartmentById(int departmentId) > { > return ByID("departmentId", departmentId); > } > > [Route("Category/{categoryId}")] > public ActionResult CategoryById(int categoryId) > { > return ByID("categoryId", categoryId); > } > > [Route("Item/{itemId}")] > public ActionResult ItemById(int itemId) > { > return ByID("itemId", itemId); > } > > [Route("SubCategory/{subCategoryId}")] > public ActionResult SubCategoryById(int subCategoryId) > { > return ByID("subCategoryId", subCategoryId); > } > > public ActionResult ByID(string key, int value) > { > = CleanIDs() > ViewBag[key] = value; > return View("Index"); > } > > public CleanIDs() > { > ViewBag["departmentId"] = 0; > ViewBag["categoryId"] = 0; > ViewBag["itemId"] = 0; > ViewBag["subCategoryId"] = 0; > return ; > }>