Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sniffdk/6135323 to your computer and use it in GitHub Desktop.
Save sniffdk/6135323 to your computer and use it in GitHub Desktop.
A slightly modified version of custom controllers/views. Works perfectly on my machine :)
public class Global : UmbracoApplication
{
protected override void OnApplicationStarting(object sender, EventArgs e)
{
base.OnApplicationStarting(sender, e);
DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(ListingPageController));
}
}
@inherits UmbracoViewPage<Starterkit.Controllers.ListingViewModel>
Current listing: @Model.CurrentListing.Name
public class ListingPageController : RenderMvcController
{
public override ActionResult Index(RenderModel model)
{
return CurrentTemplate(new ListingViewModel
{
CurrentListing = new Listing {Name = model.Content.Name}
});
}
}
public class ListingViewModel
{
public Listing CurrentListing { get; set; }
}
public class Listing
{
public string Name { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment