Skip to content

Instantly share code, notes, and snippets.

@komainu85
Created June 24, 2015 14:58
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 komainu85/964e060832998c579a54 to your computer and use it in GitHub Desktop.
Save komainu85/964e060832998c579a54 to your computer and use it in GitHub Desktop.
Sitecore Services API Controller
namespace MikeRobbins.Controllers
{
[ServicesController]
public class ChartController : ServicesApiController
{
private ISearcher _searcher;
private IMapper _mapper;
public ChartController(ISearcher iSearcher, IMapper iMapper)
{
_searcher = iSearcher;
_mapper = iMapper;
}
[HttpGet]
public List<ChartPoint> GetChartPoints(string id)
{
var sId = ID.Parse(id);
var results = _searcher.GetItemsByTemplateBucket<ChartData>(sId);
var chartPoints = _mapper.MapList<ChartData, ChartPoint>(results);
return chartPoints;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment