0

Suppose we have three controller(ASP.NET MVC3):

- NewProductController (view ->index)
- ProductModelController (view ->index(int productid))
- ProductDetailsController (view =>index(int productid, int productModelId))

user can select a product or product+productmodel from index view of NewProductController. Depending on selection we need to redirect to index view of ProductModelController OR ProductDetailsController. PLEASE GUIDE ME HOW TO DO THAT.

Again instead of showing name of the controlller in URL we want to rewrite URL to something like

http://www.myDomain/List of product
http://www.myDomain/List of LG TV

Please suggest me best approach to do this.

thanks, paul

Paul
  • 457
  • 2
  • 11
  • 26

1 Answers1

0

use 1 controller and 3 view. like that

ProductsController(int? productid, int? productModelId)
{
    if(productModelId.HasValue){
    //Some code to create model
       return View("Details",Model)
    }
    else if(productid.HasValue){

    //Some code to create model
       return View("ProductModel",Model)
    }


    //Some code to create model
       return View("NewProduct",Model)
}
Yorgo
  • 2,668
  • 1
  • 16
  • 24