나는 조금 이상한 행동을하는 경로를 모델링해야합니다. 그들이 무엇을하고 싶은지는 다음과 같습니다.ASP.NET MVC 3에서이 경로를 어떻게 모델링 할 수 있습니까?
/AssetManagement -> Asset Landing page
/AssetManagement/Add -> Add an asset
/AssetManagement/Edit -> Edit an asset
/AssetManagement/Locations -> Locations landing page
/AssetManagement/Locations/Add -> Add a location
/AssetManagement/Locations/Edit -> Edit a location
확실하지 않지만 두 컨트롤러로 모델링해야한다고 생각합니다. AssetsController 및 LocationsController. I의 의견이 존중보기 폴더 아래에있는 것/편집/인덱스를 추가하고 아마 두 개의 경로가 정의한 것이라고 생각 :
routes.MapRoute(
"AssetManagement", // Route name
"AssetManagement/{action}/{id}", // URL with parameters
new { controller = "Assets", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
new[] { "MyApplication.Web.Website.Controllers" }
);
routes.MapRoute(
"AssetManagementLocations", // Route name
"AssetManagement/{controller}/{action}/{id}", // URL with parameters
new { controller = "Locations", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
new[] { "MyApplication.Web.Website.Controllers" }
);
는 그냥 나에게 잘못을 조금 느낀다. 물건을 다룰 때 모범 사례가 누락 되었습니까? 이것이 어떤 종류의 문제를 일으킬 수 있습니까? 그들이 원하는 시스템이 이렇게 많이 만들어집니다.
// 편집 이런 질문을하는 것이 좋지 않은 곳이라면 어디에서 물어야합니까?
는 "그것은 조금을 느끼는 이유에 대해 생각을 고려 방법 나에게 잘못 "하고 더 많은 정보가 질문에 추가되어야하는지 확인하십시오. ... 당신이 어떤 느낌을 주든간에 (한 컨트롤러에서 모든 것과 같이, 모든 영역에서 ...) 라우팅을 설정할 수 있기 때문에 왜이 것이 좋지 않은지 이해하지 않고 더 나은 경로를 제안하십시오. –