public async Task<IActionResult> Edit(int id, [Bind("Id,Name,Url,IntervalInMinutes")] AlertJob alertJob) { if (id != alertJob.Id) { return NotFound(); } if (ModelState.IsValid) { var userId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); try { await alertJobService.UpdateAlertJobAsync(userId, alertJob); } catch (DbUpdateConcurrencyException) { if (alertJobService.GetAlertJobDetailsAsync(userId, id) == null) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } return View(alertJob); }
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); }