How to get parameters from URL https://localhost:5001/bmw/3series/air-conditioning

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 year ago
I have added this route:

   endpointRouteBuilder.MapControllerRoute(name: "MakeModelVariant",
             pattern: "{make}/{model}/{term}",
             defaults: new { controller = "MakeModelVariant", action = "Index"});


And this is where it comes:

public async Task<IViewComponentResult> InvokeAsync(string make,string model,string term)
        {
            term = "Control arm";
            var modelProducts = await _productService.SearchProductsAsync(keywords: term, pageSize: 4, showHidden: true);

            CatalogProductsModel catM = new CatalogProductsModel();
            catM.Products = (await _productModelFactory.PrepareProductOverviewModelsAsync(modelProducts)).ToList();
            catM.LoadPagedList(modelProducts);

            return View(catM);

        
           // return Content("");
        }



I get to the component but the values of make, model, term are all null. How can I get values here...
1 year ago
FIXED I WAS DOING IT WRONG...
1 year ago
Please share your solution, as it helps the community :)
1 year ago
Actually was looking in a component which was inside a view so basically was looking in wrong place .
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.