Decimal
Last updated
Was this helpful?
Was this helpful?
@Model.MyDecimal@Model.Value("MyDecimal")@inject IContentService Services;
@using Umbraco.Cms.Core.Services;
@{
// Get access to ContentService
var contentService = Services;
// Create a variable for the GUID of the page you want to update
var guid = Guid.Parse("32e60db4-1283-4caa-9645-f2153f9888ef");
// Get the page using the GUID you've defined
var content = contentService.GetById(guid); // ID of your page
// Set the value of the property with alias 'myDecimal'.
content.SetValue("myDecimal", 3);
// Save the change
contentService.Save(content);
}@{
// Get the page using it's id
var content = contentService.GetById(1234);
}@inject IPublishedSnapshotAccessor _publishedSnapshotAccessor;
@using Umbraco.Cms.Core.PublishedCache;
@{
// Set the value of the property with alias 'myDecimal'
content.SetValue(Home.GetModelPropertyType(_publishedSnapshotAccessor, x => x.MyDecimal).Alias, 3);
}