Skip to content

Instantly share code, notes, and snippets.

@nul800sebastiaan
Created July 13, 2015 12:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nul800sebastiaan/a640b1bbf4b7e3c1a1fa to your computer and use it in GitHub Desktop.
Save nul800sebastiaan/a640b1bbf4b7e3c1a1fa to your computer and use it in GitHub Desktop.
var contentService = UmbracoContext.Application.Services.ContentService;
var content = contentService.GetById(Model.Content.Id);
var currentValue = content.GetValue<bool>("myProp");
content.SetValue("myProp", !currentValue);
contentService.SaveAndPublishWithStatus(content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment