public bool AcknowledgeAlert(Alert alert)
        {
            var isSuccessful = _alertsService.AcknowledgeAlert(alert.Id);

            if (isSuccessful)
                BroadcastAlertAcknowledged(Clients.Others, _alertsService.Single(alert.Id));

            return isSuccessful;
        }
        public void CreateAlert()
        {
            var random = new Random();
            var randomNumber = random.Next(0, 10);
            var shouldFail = randomNumber % 2 == 0;

            var alert = new Alert
            {
                Id = Guid.NewGuid(),
                StartDateTimeUtc = shouldFail ? DateTime.Now : DateTime.UtcNow,
                Description = "Test Alert " + (_alertsService.AllActive().Count() + 1)
            };

            _alertsService.Create(alert);

            Clients.All.newAlert(alert);
        }
 private void BroadcastAlertAcknowledged(dynamic connections, Alert alert)
 {
     connections.alertAcknowledged(alert);
 }
 public void Create(Alert alert)
 {
     Alerts.Add(alert);
 }