Update multiple widgets from a one controller action

Topics: Core, General, Writing modules
May 31, 2012 at 3:10 PM

Hi Orchard experts,

I need to send a class to different widgets in the same session event - is that possible.

I can figure out how to send to one - like this:

 

public ActionResult ExamplePartial()       

{      

DashboardSettings _dashboardsettings = new DashboardSettings();                   _dashboardsettings.TimePeriodValue = 9;
        dynamic shape = _shapeFactory.dashboardMain();

        shape.dashboardsettings = _dashboardsettings;           

return new ShapeResult(this, shape);       

}

But if I need to return the result to many different shapes - how do I do that 

Hope that you can see what my problems is - need to push the same information to different widgets in the same event.

 

Thanks 

 

 

Peter

 

Coordinator
May 31, 2012 at 6:07 PM

You mean zone, not widget, and you mean shape, not class, right?

If so, inject a IWorkContextAccessor into your controller, and use it to get the layout object: var layout = _wca.GetContext().Layout. You can then add shapes to zones: layout.someZone.Add(myShape).