Мой сайт в настоящее время настроен по следующим маршрутам:
routes.MapRoute(
"BrandList",
"Brands",
new { controller = "Brand", action = "Index" }
);
routes.MapRoute(
"BrandProducts",
"{brand}/Products",
new { controller = "Brand", action = "Products", manufacturer = "" },
new { manufacturer = new BrandConstraint() }
);
routes.MapRoute(
"Product",
"{brand}/{partNumber}",
new { controller = "Product", action = "Details", brand = "" },
new { manufacturer = new BrandConstraint() }
);
Это производит URL-адреса, такие как
http://oursite/Brands -> List of all brands
http://oursite/SomeBrand -> List of one brand's products
http://oursite/SomeBrand/ProductA -> Details for product
Я только что получил директиву, которую нам теперь нужно обслуживатьдо тех же самых страниц на
http://oursite/Brands -> List of all brands
http://oursite/SomeBrand -> List of one brand's products
http://oursite/Brands/SomeBrand -> List of one brand's products
http://oursite/SomeBrand/ProductA -> Details for product
http://oursite/Brands/SomeBrand/ProductA -> Details for product
Я знаю, что могу создать еще два Маршрута, идентичных текущим BrandProducts
и Product
маршрутам, с дополнительными «Брендами /» в начале.Я сделаю это, если понадобится, но я бы предпочел не дублировать каждую запись маршрута (это больше, чем только эти два).
У кого-нибудь есть предложения?