Try our conversational search powered by Generative AI!

Ambiguous Index action methods with inheritance

Vote:
 

Hi! I have a listing page called GenericListingPage. I also have another listing page called EventListingPage, which inherits from GenericListingPage.

Also, the controller for EventListingPage inherits from the GenericListingPage's controller.

If I go to any of these pages I get an ambiguous call on the index method. I understand why, but not sure how to solve.

The first code snippet shows the top of the GenericListingPageController, the second shows the EventListingPageController:

[TemplateDescriptor(ModelType = typeof(GenericListingPage), Inherited = false)]
	public class GenericListingPageController : ContentPageControllerBase
	{
		public ActionResult Index(GenericListingPage currentPage, int page = 1)
[TemplateDescriptor(ModelType = typeof(EventListingPage))]
	public class EventListingPageController : GenericListingPageController
	{
	    public ActionResult Index(EventListingPage currentPage, int page = 1)
	    {

Does anyone know any solution for this scenario? Thanks in advance!

 

#171428
Nov 08, 2016 13:54
Vote:
 

Change this

public class EventListingPageController : GenericListingPageController

to =>

public class EventListingPageController : ContentPageControllerBase<EventListingPage>

?

#171503
Edited, Nov 08, 2016 15:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.