0

I have installed Umbraco 7 in MVC application. Have you achieved ever rendering MVC View from Surface Controller ? If it is possible to do how it can be done by passing model and passing a query string parameter to View ?

user576510
  • 5,777
  • 20
  • 81
  • 144

1 Answers1

0

If I understand your question correctly, you need to use an approach called Route Hijacking, rather than surface controllers.

Simplified, the steps are:

  • Create a model matching a given Document Type.
  • Create a mapper to map an Umbraco IPublishedContent object to the model.
  • Create a controller that inherits Umbraco.Web.Mvc.RenderMvcController.
  • Override the Index action with a signature of ActionResult Index(Umbraco.Web.Models.RenderModel model).
  • Call the mapper, and return your view.

In your view / template, you will then be able to use

@model MyNewModel

instead of

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage

Here is a very good tutorial / explanation on the approach.

Be sure to read the follow up post too

Hywel Rees
  • 884
  • 1
  • 15
  • 22