This project is read-only.


Topics: Customizing Orchard, General, Writing modules
Apr 1, 2014 at 12:30 AM
Edited Apr 1, 2014 at 12:32 AM
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