Skip to content

Instantly share code, notes, and snippets.

@sitereactor
Created February 7, 2013 15:34
Show Gist options
  • Save sitereactor/4731678 to your computer and use it in GitHub Desktop.
Save sitereactor/4731678 to your computer and use it in GitHub Desktop.
Basic example of a WebApi Controller getting a ContentService in the constructor.
using System;
using System;
using System.Net.Http;
using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.Services;
namespace Example.Controllers
{
public class WebApiUmbracoController : ApiController
{
private IContentService _contentService;
public WebApiUmbracoController()
{
_contentService = ApplicationContext.Current.Services.ContentService;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment