Alexey Ryazhskikh
Alexey Ryazhskikh

Reputation: 2500

Orchard CMS: How to update content item in command?

Want to update content item in command by code like following:

var item = _contentManager.Get(model.Id);
item.As<TitlePart>().Title = model.Title;
_contentManager.UpdateEditor(item, this);

But I have no editor in command. I can call Update method of all pars repositories, but it looks like wrong way, what is right way here?

Upvotes: 1

Views: 905

Answers (1)

mdm
mdm

Reputation: 12630

You don't need to call UpdateEditor. The session should be saved when the command finishes (you can cancel this by calling IOrchardServices.TransactionManager.Cancel()).

Upvotes: 2

Related Questions