public void ZombieSpotted(Models.ZombieSpotting details)
        {
            Clients.All.zombieSpotted(details);

            Task hubTask = SendToNotificationHubAsync(details);

            hubTask.Wait(1000);
        }
        private async Task <NotificationOutcome> SendToNotificationHubAsync(Models.ZombieSpotting details)
        {
            var connectionString = CloudConfigurationManager.GetSetting("NotificationHub.ConnectionString");
            var imageUrl         = ComputeImageUrl(details.Type);

            var payload = string.Format("{{'data':{{'message':'{0}', 'title':'{1}','imgUrl':'{2}'}}}}", details.Details, "Zombie Sighted!", imageUrl);

            var client = NotificationHubClient.CreateClientFromConnectionString(connectionString, "zombiehub_ca");

            return(await client.SendGcmNativeNotificationAsync(payload));
        }
        public ActionResult Index(Models.ZombieSpotting model)
        {
            if (ModelState.IsValid)
            {
                var context = GlobalHost.ConnectionManager.GetHubContext <Hubs.ZombieHub>();
                context.Clients.All.zombieSpotted(model);
                ViewBag.Message = "Zombie reported";

                return(View());
            }
            else
            {
                return(View(model));
            }
        }