Skip to content

Instantly share code, notes, and snippets.

@kgiszewski
Created August 12, 2014 13:31
Show Gist options
  • Save kgiszewski/05ee9984737e48f3a3d2 to your computer and use it in GitHub Desktop.
Save kgiszewski/05ee9984737e48f3a3d2 to your computer and use it in GitHub Desktop.
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