Topics: Customizing Orchard, General, Writing modules
Mar 31, 2014 at 11:30 PM
Edited Mar 31, 2014 at 11:32 PM
So I have implemented IUpdateModel in one of my controllers and use it to update data in some of my ContentItems, which is really cool!
   bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties)
        return TryUpdateModel(model, prefix, includeProperties, excludeProperties);

    public void AddModelError(string key, LocalizedString errorMessage)
        ModelState.AddModelError(key, errorMessage.ToString());

My question is as follows, can I do this in other classes that are not derived from System.Web.Mvc.Controller? I think this is a pretty nice way to update data and would like to use it in other areas of my code but am unsure of how to do it and would love to see an example.

note: I tried using dependency injection for IUpdateModel but that sort of blew up autofac.

Thanks in advance