I have a widget, its all working ish! I want to be able to pass data to the view that is not part of the ContentPart, so a ViewModel really.
When I pass a viewmodel to my view in the Get Editor, its works fine, but when Posting to Edit the values from the form are not there...which makes sense as its a different model!
So I tried adding a property to my ContentPart class
and not to the Record class. That worked great until I wanted to add a new property to the record. I added the code to migrations, the new property etc, the column was created, however it was never persisted to the database?
So I removed the "extra" property on my content class, ran the same code and the new property worked fine and was updated in the database, I then added in my "extra" property to the Part class again and its now working as before.
I'm concerned however that when I release this module to the live env. I'm going to have the same problem.
What I want to do really (I think) is pass a ViewModel to my Edit view and either get that viewmodel back in the post? (The Part class is a property on my ViewModel).
What the best solution for achieving this? I did consider using a Html helper in my view, but I need the Orchard Services and didn't think it would be possible to get a handle on that as the helper is a static class?