Created
June 24, 2015 14:58
-
-
Save komainu85/964e060832998c579a54 to your computer and use it in GitHub Desktop.
Sitecore Services API Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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