Skip to content

Instantly share code, notes, and snippets.

@hfloyd
hfloyd / PageTypesDataSource.cs
Last active May 20, 2021
Contentment Custom IDataListSource: Umbraco Page Types
View PageTypesDataSource.cs
namespace YourCode
{
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
@hfloyd
hfloyd / CG18Demo_Results.cshtml
Last active Apr 28, 2021
Umbraco 7: Example Code for 'Displaying Results After an Umbraco Form Submission'
View CG18Demo_Results.cshtml
@inherits UmbracoViewPage
@{
var sFormGuid = "26fcda6d-6a2f-46be-a164-a5dbb235fcd8"; //CG Demo form GUID
var formData = new Dragonfly.Forms.Models.FormWithRecords(sFormGuid); //Using FormWithRecords() Model
var surveyModel = new FormCgDemo(sFormGuid); //Using Custom data model (defined in an external file)
}
@hfloyd
hfloyd / AuthorizedApiController.cs
Created Apr 16, 2020
A WebAPI Controller for use in an Umbraco 8 Website in the event that you need to re-save/re-publish all Content nodes
View AuthorizedApiController.cs
namespace MyProject.Core.WebApi
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using Dragonfly.NetModels;
using Newtonsoft.Json;
using Umbraco.Core.Models;