假设我正在开发汽车门户。为了搜索新车,用户提供以下信息:
- 牌
- 模型
- 型号版本
- 汽油种类
- 预算
商业规则:
- 如果用户仅选择品牌:显示品牌列表页面,其中包含所选品牌的所有型号
- 如果用户选择品牌和型号:显示型号列表页面
- 如果用户选择品牌 + 型号 + 型号版本:显示型号版本详细信息页面。
- 如果用户选择燃料类型或预算:显示品牌列表页面。
现在我有两种方法来定义控制器和动作。
方法 1:一个具有多个操作方法的 Controller 类
Controller Class : CarSearchmanager
with following are Action Methods:
- SearchNewCar(int Barnd,int Model.......)
Depending on user selection this method will redirect control to following
action method:
- BrandListing(int BrandID......)
- ModelListing(int BrandID,intModelID.....)
- ModelVersionDetails((int BrandID,intModelID,int ModelVersionID....)
方法二:多控制器类
Controller Class : CarSearchmanager
Following are Action Methods:
- SearchNewCar(int Barnd,int Model.......)
Depending on user selection this method will redirect control to following
controller action method:
Then I will have separate controller class and action method for each of the pages like
bellow:
- BrandListing
- ModelListing
- ModelVersionDetails
我对如何组织控制器类和操作方法感到非常困惑。是否有任何最佳实践类型的文档?请给我推荐一个。