Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generic Ditto views
using System.Web.Mvc;
using Our.Umbraco.Ditto;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
namespace MappingDemo.Custom.Mvc
{
public abstract class DittoTemplatePage<T> : UmbracoTemplatePage where T : class
{
private T _mapped;
public T MappedContent
{
get {return _mapped ?? (_mapped= Model.Content.As<T>()); }
}
}
}
@inherits MappingDemo.Custom.Mvc.DittoTemplatePage<MappingDemo.Custom.Models.HomePage>
@{
Layout = "Master.cshtml";
}
<h1 style="color: red">@MappedContent.Name</h1>
<p>@MappedContent.SiteTitle</p>
@CurrentPage.GetGridHtml("content", "fanoe")
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace MappingDemo.Custom.Models
{
public class HomePage : PublishedContentModel
{
public string SiteTitle { get; set; }
public HomePage(IPublishedContent content) : base(content)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.