Created
August 12, 2014 13:31
-
-
Save kgiszewski/05ee9984737e48f3a3d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Web.Http; | |
using Umbraco.Core.Logging; | |
using Umbraco.Web.WebApi; | |
using SomeNS.Umbraco.Extensions.Models; | |
namespace SomeNS.Umbraco.Extensions.Controllers | |
{ | |
public class LocationsController : UmbracoApiController | |
{ | |
[HttpGet] | |
public object LocationsById(string locationIds) | |
{ | |
var locations = new List<MapLocationModel>(); | |
var ids = locationIds.Split(new [] { "," }, StringSplitOptions.RemoveEmptyEntries); | |
foreach (var id in ids) | |
{ | |
var content = Umbraco.TypedContent(id); | |
if (content != null && content.DocumentTypeAlias == "LocationPage") | |
{ | |
locations.Add(new MapLocationModel(content)); | |
} | |
} | |
return locations; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment