public Message GetAreaLite(string id) { SvcContext ctx = InflateContext(); if (ctx.Invalid) { return(ctx.ContextMessage); } Guid areaID = Guid.ParseExact(id, "N"); var area = new GeoService().GetAreaByID(areaID); var dto = new AreaDetailDto(area); return(ReturnAsJson(dto)); }
public Message GetArea(string id) { SvcContext ctx = InflateContext(); if (ctx.Invalid) { return(ctx.ContextMessage); } Guid areaID = Guid.ParseExact(id, "N"); ////-- TODO, check cache var area = new GeoService().GetAreaByID(areaID); if (area == default(Area) || area.Type == CfType.Province) { return(Failed("Service not invoked correctly - area not valid for operation")); } var dto = new AreaDetailDto(area); var places = CfPerfCache.GetGeoDeduciblePlaces(CfCacheIndex.Get(area.ID)); var locations = geoSvc.GetLocationsOfArea(area.ID); foreach (var l in locations) { dto.Locations.Add(new LocationResultDto(l.ID, l.TypeID, l.CountryID, l.Name, l.NameShort, l.Avatar, l.Latitude, l.Longitude, 0, l.Rating, l.RatingCount)); } var intersectionAreas = geoSvc.GetIntersectingAreas(area).Where(a => a.Type == CfType.ClimbingArea); foreach (var l in intersectionAreas) { dto.Locations.Add(new LocationResultDto(l.ID, l.TypeID, l.CountryID, l.Name, l.NameShort, l.Avatar, l.Latitude, l.Longitude, 0, l.Rating, l.RatingCount)); } return(ReturnAsJson(dto)); }