Skip to content

Instantly share code, notes, and snippets.

@glcheetham
Created January 29, 2017 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glcheetham/0b0fb369515f88e25a44d81ea13dec86 to your computer and use it in GitHub Desktop.
Save glcheetham/0b0fb369515f88e25a44d81ea13dec86 to your computer and use it in GitHub Desktop.
Loosely-Coupled Class Which uses APIs from UmbracoHelper
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MyProject.Models;
using Umbraco.Web;
using Our.Umbraco.Ditto;
namespace MyProject.Services
{
public class ResourceService : IResourceService
{
private ITypedPublishedContentQuery publishedContentQuery;
public ResourceService(ITypedPublishedContentQuery publishedContentQuery)
{
this.publishedContentQuery = publishedContentQuery;
}
public IEnumerable<Resource> GetResources()
{
return publishedContentQuery.TypedContentAtXPath("//item").As<Resource>();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment