U4-5065 - Add event to modify the model on front-end for IRenderMvcControllers

Created by Shannon Deminick 08 Jun 2014, 11:42:52 Updated by Shannon Deminick 10 Sep 2014, 12:20:21

Relates to: U4-2670

It would be handy to be able to modify/swap the model being given to front-end views from IRenderMvcControllers


Jeroen Breuer 10 Sep 2014, 11:56:20

Example on how to use:

public class UmbracoEvents : ApplicationEventHandler { protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { PreRenderViewActionFilterAttribute.ActionExecuted += PreRenderViewActionFilterAttribute_ActionExecuted; }

protected void PreRenderViewActionFilterAttribute_ActionExecuted(object sender, ActionExecutedEventArgs e)
    if (e.Controller.GetType().ToString() == "Articulate.Controllers.ArticulateRichTextController")
        var oldModel = (Articulate.Models.PostModel)e.Model;
        var newModel = new Model();
        newModel.OldModel = oldModel;
        e.Model = newModel;


Shannon Deminick 10 Sep 2014, 12:20:21

Would be awesome to add this to the real docs somewhere!

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.1.5


Story Points: