Exemplo n.º 1
0
        public async Task <IActionResult> Show(
            [FromRoute] string id
            )
        {
            var cta = await Mongo.GetCallToAction(id);

            if (cta == null)
            {
                Logger.LogInformation("Call to action {0} not found", id);
                return(NotFound());
            }

            var filter = (await Mongo.GetCallToActionFilters(id)).FirstOrDefault();

            if (filter == null)
            {
                Logger.LogError("Call to action {0} has no filter", filter);
                return(NotFound());
            }

            // HACK: shows huge Geohash
            var geohashBounds = Geohasher.GetBoundingBox(filter.CoveringGeohash[0].Substring(0, 1));

            return(View("Show", new CallToActionViewModel {
                Id = cta.Id.ToString(),
                From = filter.TimeBegin,
                To = filter.TimeEnd,
                Description = cta.Description,
                BoundingBox = geohashBounds,
                PolygonCoordinates = filter.Geometry.ToRingArray()
            }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ShowCall(
            [FromRoute] string id
            )
        {
            var call = await Mongo.GetCallToAction(id);

            if (call == null)
            {
                return(NotFound());
            }

            var filters = await Mongo.GetCallToActionFilters(id);

            return(View("CallToAction", new DashboardCallToActionViewModel {
                Call = call,
                Filters = filters
            }));
        }