public async Task<IActionResult> Details(int? id)
        {
            if (id == null)
            {
                return NotFound();
            }

            var userId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            var result = await alertJobService.GetAlertJobDetailsAsync(userId, id.Value);

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

            return View(result);
        }
Esempio n. 2
0
        public async Task Handle(StatusCheckedEvent notification, CancellationToken cancellationToken)
        {
            var alert = await alertJobService.GetAlertJobDetailsAsync(notification.Id);

            if (alert == null)
            {
                return;
            }

            alert.SetStatus(notification.Status);

            await alertJobService.UpdateAlertJobAsync(alert.UserId, alert);

            await hubContext.Clients.User(alert.UserId.ToString())
            .SendAsync("ReceiveStatus", alert.Id.ToString(), alert.CurrentStatus, alert.LastUpdatedDate.ToString(), cancellationToken);
        }
Esempio n. 3
0
        public async Task Handle(StatusCheckedEvent notification, CancellationToken cancellationToken)
        {
            var alert = await alertJobService.GetAlertJobDetailsAsync(notification.Id);

            if (alert == null)
            {
                return;
            }

            var user = await userManager.FindByIdAsync(alert.UserId.ToString());

            await alertNotifierService.SendNotificationAsync(new Dictionary <string, string> {
                { "email", user.Email },
                { "subject", "Alerter Notification" },
                { "message", $"Error in #{alert.Id} job" }
            });
        }